<?php echo validation_errors(); ?>
<?php echo form_open('form'); ?>
<input type="text" name="something" />
<input type="submit" value="submit"/>
</form>
Run Code Online (Sandbox Code Playgroud)
我发现没有"行动"和"方法"
<form action="/application/controler/somepage.php" method="POST">
</form>
Run Code Online (Sandbox Code Playgroud)
在按下提交按钮后,我想在文本框中输入值.我怎样才能像前者一样(通过POST或GET获取值)?
另外,如果我想获取URL中传递的值
http://localhost/index.php/something?value=75&today=Wed
即75和Wed,例如.
Tou*_*hid 17
试试这个:
echo form_open('controller/somepage', array('method'=>'get'));
Run Code Online (Sandbox Code Playgroud)
该CodeIgniter的表单辅助文档指出,你的手到的第一个参数form_open()的功能是您要发布帖子的网址.URL语义是CodeIgniter的重要组成部分,如果您要发布到应用程序内的某个位置,请使用:
Run Code Online (Sandbox Code Playgroud)<?= form_open('index.php/controller/function/param1/param2');?>
CodeIgniter method='post'默认使用.
CodeIgniter本身不支持form method='get'参数,因为它处理URL的方式.而不是URL:
http://localhost/myapp/index.php/something?value=75&today=Wed
Run Code Online (Sandbox Code Playgroud)
CodeIgniter的方式是:
http://localhost/myapp/index.php/mycontroller/myfunction/75/Wed
Run Code Online (Sandbox Code Playgroud)
然后,您将在控制器中定义一个函数
function myfunction($value, $day)
{
//do whatever you want with the $value and the $day here.
}
Run Code Online (Sandbox Code Playgroud)
尝试:
echo form_open('controller/somepage');
Run Code Online (Sandbox Code Playgroud)
看一下文档:
http://codeigniter.com/user_guide/helpers/form_helper.html
| 归档时间: |
|
| 查看次数: |
9333 次 |
| 最近记录: |