Log in

View Full Version : Creating member accts



europe451
11-17-2010, 05:16 PM
Hello,

I've said this before, but I'm not really a coder.

Anyway, I'm trying to create user accts using .php and mysql.

I'm following this tut: http://www.tutorialized.com/view/tutorial/User-Membership-with-PHP-and-MySQL-Tutorial/62385

and it shows up on the page without a problem, however when I do a test registration I get "Invalid email address", which of course it is not.

I think this is the problem section.


if(isset($_POST['registerSubmit']) && $_POST['registerSubmit'] == 'true'){
$registerEmail = trim($_POST['email']);
$registerPassword = trim($_POST['password']);
$registerConfirmPassword = trim($_POST['confirmPassword']);
if (!eregi("^[_a-z0-9-] (.[_a-z0-9-] )*@[a-z0-9-] (.[a-z0-9-] )*(.[a-z]{2,3})$", $registerEmail))
$errors['registerEmail'] = 'Your email address is invalid.';
if(strlen($registerPassword) < 6 || strlen($registerPassword) > 12)
$errors['registerPassword'] = 'Your password must be between 6-12 characters.';
if($registerPassword != $registerConfirmPassword)
$errors['registerConfirmPassword'] = 'Your passwords did not match.';


<h2>Register</h2>
<?php if($success['register']) print '<div class="valid">' . $success['register'] . '</div>'; ?>
<?php if($errors['register']) print '<div class="invalid">' . $errors['register'] . '</div>'; ?>

<label for="email">Email Address</label>
<input type="text" name="email" value="<?php echo htmlspecialchars($registerEmail); ?>" />
<?php if($errors['registerEmail']) print '<div class="invalid">' . $errors['registerEmail'] . '</div>'; ?>

I'm not going to post the link but by chance if you think it will help, let me know. Thanks for the help in advance, and if you need anymore info let me know.