PHPSent to Email Code Problem
Posted: Sat Dec 06, 2008 9:22 pm
I'm trying to create an equivalent of Gmail or Yahoo! on my server. I have a registration.html page with this code:
and default.php with this:
When I tested this method out, the "User Name:", "Password:", and "Confirm Password" as highlighted above in red didn't get sent to me. Can anyone help?
Code: Select all
<form method="POST" action="default.php">
<br>* = Required<br><br>
*Name: <input type="text" name="Name:" size="23"><br>
<br>
*Email: <input type="text" name="Email:" size="24"><br>
<br>
*User Name: <input type="text" name="User Name:" size="19"><br>
<br>
*Password: <input type="password" name"Password:" size="20"><br>
<br>
*Confirm: <input type="password" name="Confirm Password:" size="22">
<br>
<br>
<input type="submit" value="Submit" name="submit">
</form>and default.php with this:
Code: Select all
<center><h1><?php
if(isset($_POST['submit'])) {
$to = "me@email.com";
$subject = "Registration Request";
$name_field = $_POST['Name:'];
$email_field = $_POST['Email:'];
$username = $_POST['[color=#FF0000]User Name:[/color]'];
$password = $_POST['[color=#FF0000]Password:[/color]'];
$confirm = $_POST['[color=#FF0000]Confirm Password:[/color]'];
$body = "Name: $name_field\n E-Mail: $email_field\n User Name: $username\n Password: $password\n Confirm Password: $confirm\n";
echo "Your details were submitted. Please check your inbox within 24 hours for more instructions.";
mail($to, $subject, $body);
} else {
echo "Your details were not submitted, please try again.";
}
?>
</h1></center>