Codeigniter:如果使用GET查询字符串,如何重新填充表单?

CodeIgniter has awesome form validation class that also acts as a way to repopulate the form after submission... provided you use POST.

But how do I repopulate my form after it is submitted, if I use GET query string?

Is there a built-in method to do this, or do I have to write my own class?

Thanks a million!

You can user $this->input->get() method to read data from query string (get) and use it after form reloading (this is what you probably mean by 'repopulate').

Example:

<h5>Username</h5>
<input type="text" name="username" value="<?php echo $this->input->get('username'); ?>" size="50" />

For more read: http://ellislab.com/codeigniter%20/user-guide/libraries/form_validation.html http://ellislab.com/codeigniter%20/user-guide/libraries/input.html

Also try this.

 <input type="text" name="q" placeholder=" Search " value="<?php echo set_value('q',@$_GET['q']); ?>">