Skip to main content
Known Participant
May 12, 2011
Question

registration form submission

  • May 12, 2011
  • 1 reply
  • 1437 views

i have a registration form, which checks for errors before the form is submitted.  i was told then to use an if else statement to submit the form on the same page, but i would prefer to have the user go to a confirmation page instead.  i have the form submitting to itself to check for errors.  any ideas as to how i can do this?

This topic has been closed for replies.

1 reply

nickentin
Participating Frequently
May 12, 2011

Should be simple enough.

<?php

     if(isset($_POST['submit'])) // when your submit button has name="submit"

     {

          // code for your confirmation page

     }

     else

     {

          // code for your page with the form

     }

?>

Nick

Known Participant
May 13, 2011

here is how i modified the code:

<?php
     if(isset($_POST['register']) && empty($errors)) // when your submit button has name="submit"
     {
         echo "the form will have been submitted!";
     }
     else
     {
         echo "registration form displayed here...";
     }
?>

i want to make sure that the user did not leave any empty fields.  but i get "  the form will have been submitted" when i submit it with empty fields....

Known Participant
May 14, 2011

Where is the code for filling up the errors array?

Nick


i think i actually just put the required fields into an array, and checked if they were in there, and if they were, and that field was empty, an error message was thrown.