Forum Moderators: coopster
I have no idea why this is not working. I read some tutorials and all seems to point in the direction that, this code should work.
if(ISSET($_REQUEST['submit'])){
// Get username and password from the form
$email = trim($_REQUEST['email']);
$password = md5(trim($_REQUEST['password']));
$author = $_REQUEST['checkbox'];
// When the user is student
if($author == null){
checkStudentAccount($email,$password);
}
// Not yet implemented
if($author == 'teacher'){
print "Teacher";
die();
}
function checkStudentAccount($email,$password){
...
}
The error that I am getting
Fatal error: Call to undefined function: checkstudentaccount()
Any help will be greatly appreciated, thank you.
It might be a better approach to do something like this:
if($author == null){
$isValid = checkStudentAccount($email,$password);
}
function checkStudentAccount($email,$password) {
$validated=0;
// Do some stuff to set to 1 if valid
return $validated;
}
Now I can split the work of the function. I can make it send email and append database and return true. As mentioned by you, I can then store the return value of the function in a variable and depending up on the data in the variable I can redirect user.