Hi folks.
I'm TOTALLY new to PHP, but keen to learn it.
I got some code to use on a contact form.
I made changes to it so it so it would suit my needs a little better, and also teach me what works.
Trouble is, it doesn't work. It never send an email.
I've searched the internet and tried most of the fixes I found but all in vein.
Can anyone see where I'm going wrong?
I'm TOTALLY new to PHP, but keen to learn it.
I got some code to use on a contact form.
I made changes to it so it so it would suit my needs a little better, and also teach me what works.
Trouble is, it doesn't work. It never send an email.
I've searched the internet and tried most of the fixes I found but all in vein.
Can anyone see where I'm going wrong?
PHP:
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$message = $_POST['message'];
$email = $_POST['email'];
$formcontent= 'From: $firstname\n $lastname\n Message: $message';
$recipient = '[email protected]';
$subject = 'Contact Form';
$mailheader = 'From: $email \r\n';
mail($formcontent, $recipient, $subject, $mailheader) or die("Error!");
echo "Your contact form was sent.Thank You! <br>We will try to answer you as soon as we can"