2 questions: 1) Why won't the include file appear when called? and 2) How can I get both die messages to appear if both are false...right now if passwords don´t match and email is in wrong format only "passwords did not match" appears. If passwords match but email is incorrect format the "invalid email address" is returned. How can I get both to appear at once if both are incorrect?
Thanks
Code:
<?php
if ($password != $password2) {
die('Passwords did not match.');
}
}
if (!preg_match("/.*@.*..*/", $_POST['email_address']) | preg_match("/(<|>)/", $_POST['email_address'])) {
die('Invalid e-mail address.');
}
include 'join_fauna.php';
?>
Include file not returned when called
Moderator: General Moderators
This might work ("|" & "AND" operator precedence?) but if not you should see what I'm getting at.
Or:
Code: Select all
if(!preg_match("/.*@.*..*/", $_POST['email_address']) | preg_match("/(<|>)/", $_POST['email_address']) AND $password != $password2) {
die('Password did not match and email is invalid.');
} ELSEIF ($password != $password2) {
die('Passwords did not match.');
} ELSEIF (!preg_match("/.*@.*..*/", $_POST['email_address']) | preg_match("/(<|>)/", $_POST['email_address'])) {
die('Invalid e-mail address.');
} ELSE {
include ('join_fauna.php'); // you had: include 'join_fauna.php';
}Code: Select all
unset($nopass); unset($bad_email);
IF ($password != $password2) {
$nopass = 'Passwords did not match.';
}
IF (!preg_match("/.*@.*..*/", $_POST['email_address']) | preg_match("/(<|>)/", $_POST['email_address'])) {
$bad_email = ' Invalid e-mail address.';
}
IF (isset($nopass) OR isset($bad_email)) {
die("$nopasss . $bad_email");
} ELSE {
include ('join_fauna.php');
}