• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Use multiple forms and validation on one page

#1
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.
Reply

#2
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.
Reply

#3
Ok thanks! Will try that solution!
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme ¬© 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.