Hi Guys,
First time poster here looking for a bit of help. I don’t have much experience in php everything I learned at uni is long gone in my mind! I’ve got a simple subscription form on my website, where users can type there e-mail and press subscribe, this then e-mails me with their e-mail address so I can add them to my database. Today I tried adding 2 more fields, one for First Name and one for Last Name. No errors show up, and when you click subscribe it takes you to the correct page showing a success message, the problem is now I do not receive any e-mail from this script. Please take a look and see if you can spot where I am going wrong as I am now at a loss!
Here is the code from mailinglist1.php;
[php]Contact Us<?php
if(isset($_POST[‘submit’])) {
$to = "[email protected]";
$subject = "Promotion Mailing List";
$email = $_POST['email'];
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$body = "\nE-Mail: $email \nFirst Name: $firstname \nLast Name: $lastname";
echo "Thank you for your interest.\n Visit http://www.fakelink.com to download your free voucher.";
mail($to, $subject, $body);
} else {
echo “Error 404 : Unauthorised entry.”;
}
?>[/php]
Here is the html for my form;
[code]
<div class="form">
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td><label for="email">E-Mail</label></td>
<td><input name="email" id="input" /></td>
</tr>
<div class="form"></div>
</form>[/code]
Very grateful for anyone who can show me the stupid mistake I must be missing!
Regards, Mitchell
P.S: I would also like to know how I can redirect to a specific html page on my site once the user presses subscribe, this is not so important but would be useful.