RE: [PHP] PHP_SELF
| From: | Ralph Guzman | Date: | Thu, 02 Aug 2001 06:52:14 +0000 |
| Subject: | RE: [PHP] PHP_SELF | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-60857@lists.php.net to get a copy of this message | ||
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:trini0@optonline.net]
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: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net