Returning a value from a function
Posted: Mon Mar 29, 2004 12:49 am
We're trying to send query statements into a function and then have it output the result as another function, to be used later on on the page, where we call the row info and all that.
It's for a register page- where users have to register an ID and password for login access. If the registration is succesful then the entry is added into my MySQL database.
Here's the code:
please help! I can provide more code if needed
It's for a register page- where users have to register an ID and password for login access. If the registration is succesful then the entry is added into my MySQL database.
Here's the code:
Code: Select all
function is_valid_input ($field)
{
echo '<br>'.$field.'<br>';
switch ($field)
{
case '$email' :
if (!eregi('^їa-zA-Z0-9_\-\.]+@їa-zA-Z0-9\-]+\.їa-zA-Z0-9\-\.]+$', $email))
{
echo 'That is not a valid email address. Please return to the previous page and try again.';
return true;
}
else
return false;
break;
case '$userID' :
if(!eregi('^ї0-9]$', $userID))
{
echo 'That is not a valid user ID. Please return to the previous page and try again.';
return true;
}
else
return false;
break;
}
}
is_valid_input('$email');
is_valid_input('$userID');please help! I can provide more code if needed