Re: simple ereg question
| From: | Leif K-Brooks | Date: | Thu, 20 Feb 2003 19:38:48 +0000 |
| Subject: | Re: simple ereg question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-136404@lists.php.net to get a copy of this message | ||
Change to:No, the double quotes are needed so that $i will be parsed. The problem is the single quotes around $_POST["gamt_$i"].
if (ereg('[0-9]+',$_POST["gamt_$i"])
Greg Donald wrote:
On Thu, 20 Feb 2003, Robert E. Harvey, M.D. wrote:-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.I'd like to verify input data transferred from a form and make sure it is numeric data or null before my program executes. I am using this syntax, which doesn't work: for ($i=1;$i<=3;$i++) { if (ereg('[0-9]+','$_POST["gamt_$i"]')) { continue; } else {Try changing '$_POST["gamt_$i"]' to $_POST['gamt_$i']die("Non-numeric data entered in grass entry field(s).");} }