I've got a web page which has a form on it. When the Submit is clicked, it saves all the information to a database (SQL) using PHP.
I've got PHP validation for the email and currently when the email is incorrect it redirects to a different page with the same design but with the text 'Incorrect Email'.
Any ideas of how I would do this, if it is possible.
To redirect to the same page just needs a small change to the PHP. Either the validation of the form is done in the same page as the form with the form action pointing to the current page and a header location call redirects to the next page if the form is valid OR if the validation is done on a different page then it just needs a header location call to redirect back to the form if the validation falis - before outputting anything from the new page.
Well you could add a querystring to your url:
This is not a fully-robust solution as it is trivial to edit the address bar - but, of course, you won't be relying on this 'fail' value!!
Preferably you should add PHP to your main page which displays different content according to whether they're log-in (or email verification) was successful. It is possible to dynamically insert a JS/jQuery script to run when the page loads, but if you are doing this you might as well just use PHP to modify the page.
Personally, I use the same page to display and verify the form, only re-directing on a successful log-in, but I get the impression you don't want to re-write too much.
|All times are GMT +1. The time now is 09:39 PM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.