如何从选择选项更新数据库。
如果选择测试,则从数据库行更新用户 ID。
<form action="action.php?id=<?php echo $dnn['id'] ?>" method="post">
<select name="op">
<option value="test">test</option>
<option value="test2">test2</option>
</select>
<input name="submit" type="submit" value="submit" />
</form>
<?php
if (isset($_POST['submit']))
{
if ($_POST['op'] == "test")
{
$sql = "UPDATE * from users SET increment = increment + 1 WHERE id = '".$id."'";
mysql_query($sql);
}
else
{
echo "test2 is selected can't update the db";
}
}
?>