表单辅助函数-form_open()
使用from_open()之前需要装载本辅助函数:
$this->load->helper('form');
php===》 echo form_open('email/send')
等同于
html===》 <form method="post" action="http://example.com/index.php/email/send" />
php===》$attributes = array('class' => 'email', 'id' => 'myform');
echo form_open('email/send', $attributes);
等同于
html===》<form method="post" action="http://example.com/index.php/email/send" class="email" id="myform" />
增加隐藏域:
php===》$hidden = array('username' => 'Joe', 'member_id' => '234');
echo form_open('email/send', '', $hidden);
等同于
html===》<form method="post" action="http://example.com/index.php/email/send">
<input type="hidden" name="username" value="Joe" />
<input type="hidden" name="member_id" value="234" />