Hello! I’m using a free “contact” form that worked just fine until I added more fields and then tried to get them to be included in the email that’s sent. Now I don’t get any errors but the email isn’t being sent.
I know absolutely nothing about PHP. I did try to find the answer prior to posting here but I just don’t know enough to figure it out myself.
The form initially had just two fields - email address and message. I added several additional fields but they weren’t included in the email. I don’t know the proper format for adding them so they’ll appear in the body of the message.
Here’s the relevant code:
$first_name = $_REQUEST[‘first_name’] ;
$last_name = $_REQUEST[‘last_name’] ;
$email_address = $_REQUEST[‘email_address’] ; (this was an original field)
$phone = $_REQUEST[‘phone’] ;
$country = $_REQUEST[‘country’] ;
$adults = $_REQUEST[‘adults’] ;
$children = $_REQUEST[‘children’] ;
$arrival = $_REQUEST[‘arrival’] ;
$departure = $_REQUEST[‘departure’] ;
$comments = $_REQUEST[‘comments’] ; (the other original field)
(Original, working code):
mail( “$webmaster_email”, “This is the subject line”,
$comments, “From: $email_address” );
header( “Location: $thankyou_page” );
(With my additional variables):
mail( “$webmaster_email”, “This is the subject line”,
$first_name, $last_name, $phone, $country, $adults, $children, $arrival, $departure, $comments, “From: $email_address” );
header( “Location: $thankyou_page” );