form validation: - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: form validation: (/showthread.php?tid=5502) |
form validation: - El Forum - 01-24-2008 [eluser]ken kloud[/eluser] this form is from the user guide in form validation: myform.php <html> <head> <title>My Form</title> </head> <body> <?=$this->validation->error_string; ?> <?=form_open('form'); ?> <h5>Username</h5> <input type="text" name="username" value="<?=$this->validation->username;?>" size="50" /> <h5>Password</h5> <input type="text" name="password" value="<?=$this->validation->password;?>" size="50" /> <h5>Password Confirm</h5> <input type="text" name="passconf" value="<?=$this->validation->passconf;?>" size="50" /> <h5>Email Address</h5> <input type="text" name="email" value="<?=$this->validation->email;?>" size="50" /> <div><input type="submit" value="Submit" /></div> </form> </body> </html> form.php -controller function index() { $this->load->helper(array('form', 'url')); $this->load->library('validation'); $rules['username'] = "required"; $rules['password'] = "required"; $rules['passconf'] = "required"; $rules['email'] = "required"; $this->validation->set_rules($rules); $fields['username'] = 'Username'; $fields['password'] = 'Password'; $fields['passconf'] = 'Password Confirmation'; $fields['email'] = 'Email Address'; $this->validation->set_fields($fields); if ($this->validation->run() == FALSE) { $this->load->view('myform'); } else { $this->load->view('formsuccess'); } } myformsuccess.php <html> <head> <title>My Form</title> </head> <body> <h3>Your form was successfully submitted!</h3> <p><?=anchor('form', 'Try it again!'); ?></p> </body> </html> +++++++++++++++++++++++++++++ This is my following errors in the browser: browser: validation->error_string; ?> then in every fields of the textbox the php code will see: example:<?=$this->validation->username;?> this code is in the textbox... and my problem is if i'am doing right,, because this code did not run,, but in the user guide its run very clear to understand but in testing it, its not... sorry for this silly question... thank you for the replys... form validation: - El Forum - 01-24-2008 [eluser]ianchov[/eluser] You have to edit php.ini to enable fast tags anyway to make it work change to <?php form validation: - El Forum - 01-24-2008 [eluser]barbazul[/eluser] You can also enable the "rewrite_short_tags" option in your config.php file if you don't have access to your hosting php.ini file. There might be an impact on performance when doing this but it's a quick fix. form validation: - El Forum - 01-24-2008 [eluser]Unknown[/eluser] that's quitely right... form validation: - El Forum - 01-24-2008 [eluser]ken kloud[/eluser] thanks!!! thanks for the reply!!! maraming salamat poh... thank you very much... |