I'm kinda new to php and still trying to get my head round some of the functions and syntax.
The code I'm working on right now has 2 problems which I just can't seem to get passed, if you have any pointers I'd be very grateful.
1. in_array()
[INDENT]
$form_array = $_POST;
if(in_array("hello", $form_array)||in_array("goodbye", $form_array)){
[INDENT]echo( "hello goodbye");[/INDENT]
}
[/INDENT]
result:
Warning: in_array() [function.in-array]: Wrong datatype for second argument in /usr/home/bob/www/htdocs/application/hello.php on line 68
2. RegEXP (I always hated these, but this one is copy & paste from several sources on the web...)
[INDENT]
if(!ereg("0-9a-z@0-9a-z\.[a-z]", $form_array["email"])){
[INDENT]echo("Invalid email");[/INDENT]
}
else{
[INDENT]echo("Invalid email");[/INDENT]
} [/INDENT]
result:
both valid addresses and gibberish are rejected.