- This topic is empty.
-
AuthorPosts
-
December 31, 2010 at 5:06 pm #30908Nato595Member
Hello!
I’m using the contact form and I have everything working great… except for a group of check boxes.
When the email is sent only the first checked box in the group displays.
Basically my form is like:
Who do you serve (check all that apply)?
[] residential
[] offices
[] industrial
[] otherIf I check the 2nd and 3rd boxes, the email only displays that I checked the 2nd box.
Do I need to make a change to the contact form, the processor, or both?Thanks in advance!
December 31, 2010 at 11:34 pm #67971cybershotParticipantwhat contact form are you using? You need to display the code that you are using for the m form.
January 4, 2011 at 12:21 pm #67529Nato595MemberI started with the template of:
https://css-tricks.com/nice-and-simple-contact-form/Following is the PHP file that builds the email that is send to me:
$EmailFrom = "[email protected]";
$EmailTo = "[email protected]";
$Services = Trim(stripslashes($_POST));
// validation
$validationOK=true;
if (!$validationOK) {
print "";
exit;
}
// prepare email body text
$Body = "";
$Body .= "Services: ";
$Body .= $Services;
$Body .= "n";
$Body .= "n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
if ($success){
print "";
}
else{
print "";
}
?>Here is the contact form that is filled out by the user:
January 4, 2011 at 1:53 pm #67587cybershotParticipantThe only thing that I can think is to add to the form. You would start by changing the names of each of the services to something different. Like so
Residential
Roll-off
Landfill
Transfer Station
Portolet
MRF
Sweeping
Landfill
then in your code, you will have to add the variables like so
$residential = $_POST;
$rolloff = $_POST;
and so on
then you will have to add each variable to your form body. But you can test them to see if they are filled out first. A checkbox will return true if it is checked. so you can change the code to send the checkbox only if it is checked. Google the code for php check box to learn how to tell if it is checked. I am not positive how to do it. Oh, and one more thing. You should not have multiple id’s of services. in a page, id is good for one. So change the id’s to fit also like id=”rolloff’, id=”residential” and so on.
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.