Use multiple forms and validation on one page - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11) +--- Thread: Use multiple forms and validation on one page (/showthread.php?tid=699) |
Use multiple forms and validation on one page - mslaats - 01-07-2015 I'm trying to use 2 forms on one page and also using input validation, when using the "<?php echo validation_errors.." it displays also text fields/errors from another form on that same page. Is it possible to use validation_errors for 2 forms? Like e.g. check for the form id or name? When using if ($_POST['form'] = 'name_form_1') { echo validation_errors.. } it will display still errors from the other form. RE: Use multiple forms and validation on one page - bclinton - 01-07-2015 You could put validation_errors() into separate variables in your controllers like controller for form 1 submission: $form_1_errors = validation_errors(); controller for form 2 submission: $form_2_errors = validation_errors(); and then use those variables in your views. RE: Use multiple forms and validation on one page - mslaats - 01-08-2015 Ok thanks! Will try that solution! |