Re: [PHP] simple ereg question

2003-02-23 Thread Robert E. Harvey, M.D.
Ernest E Vogelsinger wrote: At 01:01 24.02.2003, Robert E. Harvey, M.D. said: [snip] if (is_numeric($_POST["gamt_$i"]) or empty($_POST"gamt_$i")) or this: if (is_numeric($_POST["gamt_$i"]) || empty($_POST"gamt_$i")) I get this error message (my if stat

Re: [PHP] simple ereg question

2003-02-23 Thread Ernest E Vogelsinger
At 01:01 24.02.2003, Robert E. Harvey, M.D. said: [snip] > if (is_numeric($_POST["gamt_$i"]) or empty($_POST"gamt_$i")) > >or this: > > if (is_numeric($_POST["gamt_$i"]) || empty($_POST"gamt_$i")) > >I get this error message (my if statement is on line 5): >

Re: [PHP] simple ereg question

2003-02-23 Thread Robert E. Harvey, M.D.
John W. Holmes wrote: 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-nu

RE: [PHP] simple ereg question

2003-02-20 Thread John W. Holmes
> 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 > { >

Re: [PHP] simple ereg question

2003-02-20 Thread Leif K-Brooks
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: I'd like to verify input data transferred from a form

RE: [PHP] simple ereg question

2003-02-20 Thread Kelly Protsko
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] .""; if (eregi('^[0-9]+$',$_POST[vari]) || $_P

Re: [PHP] simple ereg question

2003-02-20 Thread Greg Donald
On Thu, 20 Feb 2003, Robert E. Harvey, M.D. wrote: >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"]')) > {

RE: [PHP] Simple ereg question

2003-02-19 Thread Kelly Protsko
You had it pretty close but try and make a few minor changes to it I've tested the function below and it works for what you are trying to do. I am not sure of a way to test for the null with eregi other than putting and or statement in. if (eregi('^[0-9]+$', $_POST["gamt_$i"]) || $_POST["gamt_$