Welcome Guest, Not a member yet? Register   Sign In
I have few questions...
#2

[eluser]TheFuzzy0ne[/eluser]
1) You need to collect the data after you've run the validation.
Code:
// Validation
$this->load->helper('form');    
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<span class="info error">', '</span>');
$this->form_validation->set_rules('i_fullname', 'lang:fullname', 'trim|required|xss_clean');
$this->form_validation->set_rules('i_birthdate', 'lang:birthdate', 'trim|required|xss_clean');
$this->form_validation->set_rules('i_country', 'lang:country', 'trim|required|xss_clean');

// Collectiong User Input
$fullname = ucwords($this->input->post('i_fullname'));
$birthdate= convert_datetime($this->input->post('i_birthdate'), 'mysql');
$country= ucwords($this->input->post('i_country'));
$city = ucwords($this->input->post('i_city'));
$email = $this->input->post('i_email');
$username = $this->input->post('i_username2');
$password = $this->input->post('i_password2');
$password_confirm = $this->input->post('i_password2_confirm');
$captcha = strtoupper($this->input->post('i_captcha'));

All of the functions above can be called from within you're validation, so all you need to do is access the data using $this->input->post('field_name');

2) Again, you're accessing the post array before it's been validated and sanitized. You should either access it when validation is complete, or if you absolutely must use it, it's wise to sanitise it first by passing TRUE in as the second parameter to $this->input->post();
Code:
$email = $this->input->post('i_email', TRUE);

3) Validation callbacks can be in their own helper, or even model if you wish. You can also store them in a config file (Please see the [url="http://ellislab.com/codeigniter/user-guide/libraries/form_validation.html#savingtoconfig"]user guide[/url] for further information), or extend the validation helper.


Messages In This Thread
I have few questions... - by El Forum - 06-20-2009, 03:21 AM
I have few questions... - by El Forum - 06-20-2009, 04:11 AM
I have few questions... - by El Forum - 06-20-2009, 08:53 PM
I have few questions... - by El Forum - 06-21-2009, 05:36 AM
I have few questions... - by El Forum - 06-21-2009, 07:01 AM
I have few questions... - by El Forum - 06-21-2009, 07:12 AM
I have few questions... - by El Forum - 06-21-2009, 07:14 AM



Theme © iAndrew 2016 - Forum software by © MyBB