Hi ho,
I've just finished work on a PHP script that takes information from a simple online HTML form then puts that info into a database and then displays the entire database on the screen.
So, when a user fills out this little form of mine three things happen:
It attempts to add the submitted details to a database.
It takes the user to a new webpage which displays the entire database in a table.
It either tells the user "Well done. Your info was successfully added" OR, it tells the user "Sorry, your info couldn't be added because... bla bla bla".
(but in either case, it still takes the user to the new page and displays the database info as it stands)
Anyway, it's working well, and all in all I'm quite happy with it.
But, there's just one thing that I'm not sure about...
Is there any way that I can have it so that if the user screws up the HTML form (e.g., leaves a box blank) then INSTEAD of going to the new page with the database, it just shows him the form again with a message that says "Hey man- you left the box blank"??? (or something like that)
I'm not wanting an all out page refresh of the form page because I don't want the user to have to re-enter the data that he's already typed out and got right.
I know it's a big and slightly awkward problem. The whole crux of the problem seems to be that when they hit submit, they are automatically taken to the other page.
Anyway, if someone could even just point me in the right direction that I'd be as happy as can be.
Thanks!