我正在使用 Codeigniter 构建表单。
提交按钮是:
echo form_submit('submit', 'Buy it', "id='bred'");
现在我在同一个 php 文件中处理表单:
if (isset($_POST['submit'])) {
$query = "INSERT INTO table (product, price) VALUES ('$product', '$price')";
mysql_query($query)
or die(mysql_error());
//after inserting in the database I need to delete the submit button, so the form cannot be submitted twice
}
插入数据库后,我需要删除/更改 css 为不透明度 0/更改 css 以不显示提交按钮,因此表单不能提交两次。
我该怎么做?
谢谢
最佳答案
除了您不保存的方式: 由于“回显”按钮,您无法使用 PHP 将其删除
一种(不是很时尚)的方法是回显一些删除按钮的 JS 代码。
关于php - Codeigniter:删除或更改表单按钮样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7663679/