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

ok, so here is how i modified it...

<?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 have an error array that prints out what the user needs to fill in yet.  i have to make sure that it is empty before the form is submitted.  am i doing this right? when i run it with empty fields, it prints out, "  the form will have been submitted"...