gather checkbox data from form into email


Posted on 16th Feb 2014 07:03 pm by admin

Hello all,

First, i'd like to thank everyone who responded to my previous posts regarding setting up an SMTP server for my php form. I ended up figuring it out and my form is up and functioning, sending me formatted html emails flawlessly.

But... step two in my process, is now i have to figure out how to pass my checkbox values into the email...

I had previously had the checkboxes commented out while i was trying to just get the form working, but now that i have done that i have to figure out these checkboxes.

my form can be seen here....

http://www.adobedayevents.com/project_request/project_request.php

all the values (other than the checkboxes) are passing to my send_request.php page, and are all sending to my email address formatted. But now i need to figure out how to take my checkbox data and pass it through the send_request.php page and send in the email.

Here is the checkbox...(only posting checkbox because the form is huge and i alredy got everything else working...)

Code: <label><strong>Company/Customer Name:</strong></label><br/>
<input type="text" name="company_customer_name" /><br/><br/>

<label><strong>Please indicate the materials required (check all that apply):</strong></label><br/>
<input type="checkbox" name="check_1" value=".html email invitation" />&nbsp;&nbsp;<label><strong>.html email invitation</strong></label><br/>
<input type="checkbox" name="check_2" value="agenda" />&nbsp;&nbsp;<label><strong>agenda</strong></label><br/>
<input type="checkbox" name="check_3" value="registration site (confirmation email, (2) reminder emails" />&nbsp;&nbsp;<label><strong>registration site (confirmation email, (2) reminder emails</strong></label><br/>
<input type="checkbox" name="check_4" value="Thank You Emails" />&nbsp;&nbsp;<label><strong>"Thank You" Emails</strong></label><br/>
<input type="checkbox" name="check_5" value="Signage" />&nbsp;&nbsp;<label><strong>Signage</strong></label><br/>
<input type="checkbox" name="check_6" value="Email Broadcasts" />&nbsp;&nbsp;<label><strong>Email Broadcast(s)</strong></label><br/>
<input type="checkbox" name="check_7" value="Report prepupload" />&nbsp;&nbsp;<label><strong>Report prep/upload</strong></label><br/><br/>
here is where all my values from the all the text fields and dropdowns are pulled in...

Code: <?PHP
$to = "rkettering@jpenterprises.com";
$nameto = "Randy Kettering";
$from = "admin@adobedayevents.com";
$namefrom = "Adobe Day Events Administrator";
$subject = "Project Request";

$field_mark_manager = $_POST['1_mark_manager'];
$comp_cust_name = $_POST['company_customer_name'];

//retrieve checkbox variable here

$icf_source_code = $_POST['icf_source_code'];
$lead_code = $_POST['lead_code'];
$product_interest = $_POST['product_interest'];
$add_product_interest = $_POST['additional_product_interest'];
$number_of_units = $_POST['2_units_number'];
$purchase_timeline = $_POST['3_purchase_timeline'];
$industry = $_POST['4_industry'];
$employee_range = $_POST['5_employee_range'];
$revenue_range = $_POST['6_revenue_range'];
$due_date_month = $_POST['7_month'];
$due_date_day = $_POST['8_day'];
$due_date_year = $_POST['9_year'];
$additional_comm = $_POST['additional_comments'];

$message = "Field Marketing Manager: $field_mark_manager<br />
Company/Customer Name: $comp_cust_name<br />
ICF Source Code: $icf_source_code<br />
Lead Code: $lead_code<br />
Product Interest: $product_interest<br />
Additional Product Interest: $add_product_interest<br />
Number of Units: $number_of_units<br />
Purchase Timeline: $purchase_timeline<br />
Industry: $industry<br />
Employee Range: $employee_range<br />
Revenue Range: $revenue_range<br />
Due Date: $due_date_month $due_date_day, $due_date_year<br />
Additional Comments: $additional_comm";

authSendEmail($from, $namefrom, $to, $nameto, $subject, $message);
?>

as you can see, first im pulling in all the variables from the form. Then, $message echoes them all out so that they are all on their own line. Can anybody help me figure out how to get the checkbox data to pass and post into the email? i can post a screenshot of how the email looks when its sent if that will help anyone understand better.

Are the 'name' values on my checkboxes correct? or should they all be named the same?

Any help would be greatly appreciated!!

Randy Kettering

No comments posted yet

Your Answer:

Login to answer
101 Like 11 Dislike
Previous forums Next forums
Other forums

add 20 000 to the rowcnt
Hi ...
I need to add 20 000 to the row count but just cant find a way to do this i am new to php

IMAGE - SERVER SIDE scripting help...
How to receive pixel data of an image and buid a bitmap file on the server using the HTTP POST metho

Slashes
Have a small problem and I'm not able to understand why I'm getting the results I'm getting... and i

Had a simple form script that suddenly stopped working
It was made about a year ago and had been working fine. Last time it was known to work for sure was

Tree Menu
Hi guys,

Can anyone help me making a tree navigation system? I have a site where I'm allowin

Sending an SMS Message with ASP.NET
Often times it may be a requirement for your web application to send an SMS message. Such examples w

PHP Redirecting
Hello everyone. Is there a way to redirect people to pages within a statement in PHP? Since there is

Facebook status update API
Hello,

So, I'm trying to create my first Facebook application with PHP.

Basic ideas fo

Help with Contact Form
I have this Form on an html page and the associated code on page.php (below).
I keep getting the

FILTER_CALLBACK -- Files?
Hi All,

I'm using the php filter functions to validate my form data. For custom filters, I'm

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash