Won't Echo?

I’m typing a register page, but when I try to test to see if my error messages come up, nothing happens. I doesn’t tell me that anything is wrong with the code, but my messages don’t pop up. For example, if I leave all the Registration fields empty and hit the submit button, then an error message should come up saying “All fields required.”, but nothing happens. Here’s my code, what do you think is wrong? (referring to line 36)
[php]<?php
include ‘init.php’;
include ‘template/header.php’;
?>

Register

<?php if (isset($_POST['register_email'], $_POST['register_name'], $_POST['register_password'])) { $register_email = $_POST['register_email']; $register_name = $_POST['register_name']; $register_password = $_POST['register_password']; $errors = array(); if (empty($register_email) || empty($register_name) || empty($register_password)) { $errors[] = 'All fields required.'; } else { if(filter_var($register_email, FILTER_VALIDATE_EMAIL) === false) { $errors[] = 'Email Address not valid.'; } if (strlen($register_email) > 255 || strlen($register_name) > 35 || strlen($register_password) > 35) { $errors[] = 'One or more fields contains too many characters.'; } if (user_exists($register_email)) { $errors[] = 'That email has already been registered.'; } } if (!empty($errors)) { foreach ($errors as $error) { echo $error, '
'; } } else { } } ?>

Email:

Full Name:

Password:

<?php include 'template/footer.php'; ?>[/php]

it looks like you don’t have name="" in you submit line<input type="submit" name="submit" value="Register"/> or you can do this <input type="hidden" name="action" value="register" />. and this is what I do [php]if ( (!empty($_POST)) && ($_POST[‘action’] == “register”))[/php].

Sponsor our Newsletter | Privacy Policy | Terms of Service