Actually there is no need for you to use exit(); If you choose to use this
method cheking for empty fields one at a time rather than all at once; you
can simplify your code a bit as follows:
If($HTTP_POST_VARS){
if(!$Age) { echo "Please enter your age"; }
elseif(!$Email){ echo "Please enter your email"; }
else
echo "Thanks for your submission";
// continue processing...
...
...
}
}
but in any case, I'm glad I was of help.
-----Original Message-----
From: Gerard Samuel [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 01, 2001 12:50 PM
To: PHP
Subject: Re: [PHP] PHP_SELF
Ok, I would like to thank Ralph Guzman & Richard Lynch for your help.
I combined your ideas into my own working example.
Just posting here for archiving/discussion purposes...
// Input some data //
echo "<form action=\"$PHP_SELF\" method=\"POST\"
enctype=\"multipart/form-data\">\n";
echo "1. Age:<br>\n";
echo "   <input type=\"text\" name=\"Age\" size=\"4\"
maxlength=\"2\" value=\"$Age\"><p>\n";
echo "2. Email:<br>\n";
echo "   <input type=\"text\" name=\"Email\" size=\"25\"
maxlength=\"30\" value=\"$Email\"><p>\n";
echo "   <input type=\"submit\" name=\"submit\"
value=\"Submit\">\n";
// Start error correction //
if (!$HTTP_POST_VARS) { exit(); }
elseif (!$Age) { echo "Please enter your age.<br>\n"; }
elseif (!$Email) { echo "Please enter your email.<br>\n"; }
else { echo "Thanks for your submission.\n"; }
// Do what you want with you sanitised strings //
.......... :)
Thanks again guys...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]