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
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):
>
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
> 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
> {
>
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
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
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"]'))
> {
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_$
8 matches
Mail list logo