我有一个看起来像这样的 HTML 表单:
<form action="stock.php" method="post">
Item1 S:<input value="remove" name="remove1S" type="submit" />
Item2 M:<input value="remove" name="remove1M" type="submit" />
</form>
和 PHP:
$file = fopen("stock.txt", "a+");
//when "remove1S" is clicked on
fwrite($file,"Removed one");
//when "remove1M" is clicked on
fwrite($file,"Removed two");
我该怎么做我在评论中所说的?我确定它正在使用类似的$_POST['remove1S']
东西
if (__onClick__ $_POST['remove1S'])
{fwrite($file,"Removed one");
}