RE: [PHP-DB] error checking question

From: Date: Fri, 27 Jun 2003 08:44:22 +0000
Subject: RE: [PHP-DB] error checking question
Groups: php.db 
Request: Send a blank email to php-db+get-28941@lists.php.net to get a copy of this message
> -----Original Message----- > From: dpgirago@mdanderson.org [mailto:dpgirago@mdanderson.org] > Sent: 26 June 2003 20:22 > > 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? One simple way: header("Location: http:/your.server.name/path/to/main_page.php?err=$errcode"); exit(); And then emit an error in main_page.php if $_GET['err'] is set. If you're using sessions, another way would be to set an error variable in the session. Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: m.ford@lmu.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

« previous php.db (#28941) next »