Anyone know why when a form posts to the “thanks” page containing the code below it keeps giving the error message and not sending the data to the email address?
<?php $Name="$Name"; $Telephone="$Telephone"; $Email="$Email"; $DateofArrival="$DateofArrival"; $NumbrofNights="$NumberofNights"; $NumberofPeople="$NumberofPeople"; $Comments="$Comments"; $mail_from="$Email"; $header="from: $Name <$mail_from>"; $to ='[email protected]'; $send_contact=mail($to,$subject,$Telephone,$Email,$DateofArrival,$NumberofNights,$NumberofPeople,$Comments,$header); if($send_contact){ echo "Thanks for getting contacting us. We'll be in-touch soon."; } else { echo "There was an error processing the form."; } ?>Hi there,
My first step would be to say that the mail() function has way too many parameters ($NumberofNights and onwards will be completely ignored).
The correct syntax for this command is:
[php]mail($to,$subject,$message,$headers);[/php]
You may want to combine your parameters into a single variable called $message.