I have a form with a checkbox so the user can select multiple items from the checkbox, the submission and everything works ok, just need help getting the values from the checkbox. I realize this isnt exactly CodeIgniter help but any help you can give is much appreciated...
Here is my form code for the checkbox. I'm just trying to get the $productSheets variable to print all the values in the email at the bottom...
Code:
<tr>
<td>
<label style="margin-top:10px;" for="checkbox" id="productSheets">Which products are you interested in?</label>
<input type="checkbox" name="productSheets[]" value="lidar"> LiDAR - IR Laser Array Field<br>
<input type="checkbox" name="productSheets[]" value="nui"> NUI-IR Laser Array Chip<br>
<input type="checkbox" name="productSheets[]" value="optical"> Optical Solutions
</td>
</tr>
and here is the code from my process.php file. The other variables display fine.
Code:
<?php
//prepare mail headers
$to = "[email protected]";
$from = "[email protected]";
$headers = "From: Corp <$from>";
$subject = "Product Sheet Request";
//prepare request form variables
$firstName = $_REQUEST['firstName'];
$lastName = $_REQUEST['lastName'];
$email = $_REQUEST['email'];
$phone = $_REQUEST['phone'];
$affiliation = $_REQUEST['affiliation'];
$interest = $_REQUEST['interest'];
if($interest == 'inclusion'){
$interest = 'Evaluating for inclusion in product';
} elseif($interest == 'general'){
$interest = 'Interested in the technology generally';
} elseif($interest == 'research'){
$interest = 'Performing market research';
} elseif($interest == 'solutions'){
$interest = 'Looking for competitive solutions';
}
$referredBy = $_REQUEST['referredBy'];
$additional = $_REQUEST['additional'];
$productSheets = $_REQUEST['productSheets'];
//prepare message body
$body =
"A user has requested product sheet(s). Please review their information and respond:\n
First Name: ".$firstName."\n
Last Name: ".$lastName."\n
Email: ".$email."\n
Phone Number: ".$phone."\n
Affiliation: ".$affiliation."\n
Reason for Interest: ".$interest."\n
Referred By: ".$referredBy."\n
Additional Questions/Comments: ".$additional."\n
Product Sheet(s) Requested: ".$productSheets."\n
This message was sent automatically from the Product Sheet Requests form on the website.
";
//send the message/info to personel
$send = mail($to, $subject, $body, $headers);
?>