Tjobbe
November 30th, 2004, 21:23
I know that to check for a valid email address, I have to create a new function, such as:
function isValidEmail ($emailaddy) {
return eregi("^[a-z0-9_]+@[a-z0-9\-]+\.[a-z0-9\-\.]+$", $emailaddy);
where emailaddy is the field the user enters their email address.
I'm just not sure, throguh having watched a VTC php tutorial, where I should include it on my registration.php script, im just a bit confused there.
Also, I want to make sure that certain fields are filled in, and currently it only checks if only one of the the following two fields are empty:
else if ($user || $pass) {
// if the user has filled in one field but not the other,
// throw up this error
echo "Please fill in all fields.";
}
I want it to check a few fields. $emailaddy, $user, $pass and $phonenum
I am assuming I do this:
if (!$user, !$pass, !$phonenum, !$emailaddy){
echo "Please fill in all the required fields.";
but I get this:
Parse error: parse error, unexpected ',' in C:\xampp\htdocs\php\login\register.php on line 47 which is the line i just wrote!
If anyone can point me onto the right track i'd be most greatful!
function isValidEmail ($emailaddy) {
return eregi("^[a-z0-9_]+@[a-z0-9\-]+\.[a-z0-9\-\.]+$", $emailaddy);
where emailaddy is the field the user enters their email address.
I'm just not sure, throguh having watched a VTC php tutorial, where I should include it on my registration.php script, im just a bit confused there.
Also, I want to make sure that certain fields are filled in, and currently it only checks if only one of the the following two fields are empty:
else if ($user || $pass) {
// if the user has filled in one field but not the other,
// throw up this error
echo "Please fill in all fields.";
}
I want it to check a few fields. $emailaddy, $user, $pass and $phonenum
I am assuming I do this:
if (!$user, !$pass, !$phonenum, !$emailaddy){
echo "Please fill in all the required fields.";
but I get this:
Parse error: parse error, unexpected ',' in C:\xampp\htdocs\php\login\register.php on line 47 which is the line i just wrote!
If anyone can point me onto the right track i'd be most greatful!