简体   繁体   English

这种形式(codeigniter)不起作用

[英]this form (codeigniter) doesn't work

I don't seem to be able to make a simple form work in codeigniter.. 我似乎无法在Codeigniter中制作简单的表格。

the following code: 以下代码:

$this->load->helper('form');
echo form_open('welcome/test_form');
echo form_button('button_name', 'click!');
echo form_close();

produces the following HTML: 产生以下HTML:

<form action="http://localhost:8888/index.php/welcome/test_form" method="post" accept-charset="utf-8">
<button name="button_name" type="button" >click!</button>
</form>

Yet when i click on the button nothing happens, the page stays the same. 但是,当我单击该按钮时,没有任何反应,页面保持不变。

Any ideas? 有任何想法吗?

You're not creating a submit button. 您没有创建提交按钮。 You need to use something like this: 您需要使用以下内容:

$this->load->helper('form');
echo form_open('welcome/test_form');
echo form_submit('button_name', 'click!');
echo form_close();

docs here: 此处的文档:

http://ellislab.com/codeigniter/user-guide/helpers/form_helper.html http://ellislab.com/codeigniter/user-guide/helpers/form_helper.html

the button element is not the same as a submit button. button元素与submit按钮不同。 It won't submit your form. 它不会提交您的表格。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM