Did you try this syntax yet? The with the ^ and $ search matching beginning and end I tested out the code myself and it worked fine. http://www.theoutersphere.com/testing/testnumbers.php
//here is the exact code that I used echo $_POST[vari] ."<br>"; if (eregi('^[0-9]+$',$_POST[vari]) || $_POST[vari] == null) { echo " continue This is a valid number"; } else { die("Non-numeric data entered in grass entry field(s)."); } Kelly -----Original Message----- From: Robert E. Harvey, M.D. [mailto:[EMAIL PROTECTED]] Sent: February 20, 2003 12:34 PM To: php; Robert Harvey Subject: [PHP] simple ereg question Hello folks, 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 { die("Non-numeric data entered in grass entry field(s)."); } } No matter what I put in the fields, the program dies and I get the death message. What can I do to fix this? TIA Bob Harvey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php