【发布时间】:2011-12-01 14:19:31
【问题描述】:
我正在使用 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更改为opacity 0/更改css以不显示提交按钮,因此表单无法提交两次。
我该怎么做?
谢谢
【问题讨论】:
-
为什么不在控制器中处理表单?
-
除了在控制器之外处理表单之外,您正在查询没有框架的方法,而是使用旧的 mysql_* 函数而不是在模型中。还有什么?
标签: php css forms codeigniter submit