RE: error checking question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----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 


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux