我的代码:
<div id='tagbox' style='display: none;'>
<form method="POST" name="newtagadd">
<input type="text" name="tagaddbox" class="form-control" style="width: 400px; display: inline;" placeholder="Füge Tags hinzu..."/>
<label for="submittag" class="btn"><span class="glyphicon glyphicon-plus" style="color: orange; display: inline;"></span></label>
<input type="submit" id="submittag" class="hidden" />
</form>
<br/>(Tags mit Komma trennen. Beispiel: tag1,tag2,tag3)
</div>
</div>
</div>
<?php
require_once("config.php");
if(isset($_POST['submittag']))
{
$tagaddbox = $_POST['tagaddbox'];
$q = mysql_query("UPDATE img_data SET tags=$tagaddbox, WHERE id=$id") or die (mysql_error());
}
?>
<div class="clear"></div>
<?php
echo '<a id="stream-prev" style="display: inline; text-decoration: none;" class="pict" href="image.php?id=$id"><span class="glyphicon glyphicon-chevron-left"></span></a>';
echo '<a id="stream-next" style="display: inline; text-decoration: none;" class="pict" href="image.php?id=$id"><span class="glyphicon glyphicon-chevron-right"></span></a>';
?>
所以没有任何反应,页面刷新,如果我按f5,我会被问到,如果我想再发送它(firefox)
感谢每一个答案。答案 0 :(得分:1)
更新的正确SQL语法不包括SET和WHERE子句之间的逗号
错误
&#34; UPDATE img_data SET tags = $ tagaddbox,WHERE id = $ id&#34;
右
&#34; UPDATE img_data SET tags = $ tagaddbox WHERE id = $ id&#34;
此外,您需要一个名称而不仅仅是
上的ID<input type="submit" id="submittag" name="submittag" class="hidden" />