|
Posted by linda on 11/15/06 21:15
Can anyone see the error! I've been looking for over three hours and I just
can find it. I'm getting a parse error. I just can't find it, what am I
missing? Sigh.... I hoping someone else can see it.
Best wishes,
Linda
<?php
$title = 'Register';
include_once 'includes/header.html';
?>
//Check if the form has been submitted.
if (isset($_POST[submitted])) {
$errors = array(); //Initialize error array.
//Check for a name.
if (empty($_POST['name'])) {
$errors[] = 'You forgot to enter your name.';
}
//Check for an email address.
if (empty($_POST['email'])) {
$errors[] = 'You forgot to enter your email address.';
}
//Check for a password and match against the confirmed password.
if (empty($_POST['password1'])) {
if ($_POST['password1'] !=$_POST['password2']) {
$errors[] = 'Your passwords did not match.';
}
} else{
$errors[] = 'You forgot to enter your password.';
}
//Register the user here.
//Send them an email.
$body = "Thank you for registering with us.\n\nYour Password Is:
'{$_POST['password1']}'.\n\nSincerely Admin\nMy domain name";
mail ($_POST['email']), 'Thank you for registering', $body, 'From:
admin@mydomain.co.uk';
echo '<h2>Thank You!</h2>
<p>You are now registered. An email has been sent to your email address
confirming the information.<br />';
//Report the errors.
}else{
echo '<h2>Error!</h2>\n
<p>The following error(s) occured:<br /></p>';
foreach ($errors as $msg) { //Print each error message.
echo " - $msg<br />\n";
}
echo '</p><p>Please correct the fields.<br /></p>';
} else{
//Display the form.
?>
<fieldset>
<legend><h2>Register For An Account</h2></legend>
<form action="register.php" method="POST">
<input type="hidden" value="TRUE" name="submitted" />
<p align="left">Please ensure the email you supply is valid, as accounts
where email confirmations bounced back after registration <b>are
deleted</b>!</p>
<table>
<tr>
<td>Name: </td>
<td><input type="text" name="name" size="50" /></td>
</tr>
<tr>
<td>Email Address: </td>
<td><input type="text" name="email" size="50" /></td>
</tr>
<tr>
<td>Password: </td>
<td><input type="password" name="password1" /></td>
</tr>
<tr>
<td>Confirm Password: </td>
<td><input type="password" name="password2" /></td>
</tr>
<tr>
<td COLSPAN="2" align="right"><input type="submit" value="Register" /></td>
</tr>
</table>
</form>
</fieldset>
<?php
}//Close the main IF_ELSE.
include_once 'includes/footer.html';
?>
Navigation:
[Reply to this message]
|