Form Input Gets 1 Word
Posted
by 01010011
on Stack Overflow
See other posts from Stack Overflow
or by 01010011
Published on 2010-04-26T06:30:43Z
Indexed on
2010/04/26
6:33 UTC
Read the original article
Hit count: 151
codeigniter
|php
Hi
Using Codeigniter, how do I get and display, from my controller, all of the text a user entered into a text field on a view? I only get the first word, and nothing after the spaces.
Here are my form_validation rules
$this->form_validation->set_rules(
'field_name','Field Name','trim|required|alpha_numeric|tolower|xss_clean');
And here is my controller
public function my_method() {
if ($this->input->post()) {
$name = $this->input->post('search');
echo $name;
}
}
and my view
?php echo form_open('my_controller/my_method'); ?>
<?php echo form_input('search'); ?>
<?php echo form_submit('submit', 'Search'); ?>
© Stack Overflow or respective owner