Jump to content
IAmBill

Creating A Registration Form: Proper Way To Redirect A Bad Registration

Recommended Posts

Hi, I'm trying to create a very simple registration form. Nothing fancy, just a log-in, password, email address, and a couple of confirmations. While I have it set up in AJAX to alert the user if they're using a log-in or email address already in the database, I have to tend to those than don't support AJAX and redirect back to the registration page if they try to submit a registration with errors.So, the checks are easy enough... I don't have problems identifying whether or not they've made a bad registration. The issue is that I don't know the proper way to redirect the user back to the registration form if it's invalid. If I use the header() function it clears the text fields which I don't want. The second alternative is to write out the submission page as a form that writes out all of the fields with their values, then submits itself to the registration form which will then fill in the fields if the $REQUESTs are available. This seems... less than elegant, though.There are millions of registration forms all of the internet... It's a pretty common thing, which is why I'd like to do it correctly. Could anyone endulge me on what the server-side scripts look like on a registration submission?

Share this post


Link to post
Share on other sites
I always have the forms submit to themselves and check for data to automatically fill in. Check here for an example:http://w3schools.invisionzone.com/index.php?showtopic=12509
Thank you, justsomeguy.Submit to itself... it's so obvious that I can't believe I didn't think of it myself. Regardless, that link provides tons of tips that I definitely wasn't doing properly. Thanks again for everything.

Share this post


Link to post
Share on other sites

To be fair justsomeguy's script still manually inserts the form values from the previous submission attempt in each field value, so that still has to happen. It's still simpler than the way I do it at present which is to post the form to a separate handler and set the various values to the session if I need to redirect the user back to the form. I may well change that as it does mean I've got a bunch of session variables that I don't have a great deal of further need for. That said, while setting the values to session variables means more code, now that I've done it it means more work to change it. Much of a muchness I suppose.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...