error checking question
| From: | dpgirago at mdanderson dot org | Date: | Thu, 26 Jun 2003 19:21:54 +0000 |
| Subject: | error checking question | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-28925@lists.php.net to get a copy of this message | ||
Hello everyone,
I've been experimenting with checking for errors in data inserted into a table
using an html form. The main page displays the result of a "select * from
the_table" at the top of the page, with the form for inserting the data beneath.
The SQL for the insert occurs on a different page, with redirection back to the
main page using the header() function ( as I've learned to do from reading this
list ). This all works well. The inserted data shows up in the table, and there
are no surprises when refreshing, etc... I have also implemented some error
checking on the client side using JavaScript, and this is also working well.
What I would like to do is somehow have a redundant error check on the server
side and then display an error message above the form on the main page should
fields be left blank or forbidden characters entered. Since I have access to the
$_POST['variables'] on the form processing page, I've already written some code
to detect the presence of error characters, etc...and no query is performed if
there is an error. But how do I pass a "flag" variable back to the main page to
echo an appropriate message above the form?
Advice or suggestions greatly appreciated.
David