bumblebee Posted September 22, 2011 Share Posted September 22, 2011 Hi I just barely made it through sending form to email using php. now I have another problem with checkboxes. please help! whenever I select multiple checkbox options. the form only sends me the last check box option checked. not all checked options. here's my php code : <?php /*Subject and Email Variables*/ $emailSubject = 'Inquiry'; $emailAddress = '[email protected]'; /*Gathering Data Variables*/ $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $contact = $_POST['contact']; $email = $_POST['email']; $newsletter = $_POST['newsletter']; $projects = $_POST['ch']; $trippingSchedule = $_POST['tripping']; $source = $_POST['source']; $agent = $_POST['agent']; $comments = $_POST['comments']; if($_POST['submit']) { $projects = $_POST['projects']; foreach($projects as $ch) } $body = <<<EOD <br/><hr/><br/> Firstname : $firstname<br/> Lastname : $lastname<br/> Contact: $contact<br/> Email : $email<br/> Newsletter : $newsletter<br/> Projects : $ch<br/> Tripping Schedule : $trippingSchedule<br/> Source : $source<br/> Agent name : $agent<br/> Additional Comments : $comments<br/> EOD; $headers = "From: $email\r\n"; $headers .= "content-type: text/html\r\n"; $success = mail($emailAddress, $emailSubject, $body, $headers); /* Results render as HTML*/ $theResults = <<<EOD (some html here) EOD; echo "$theResults"; ?> MOD EDIT: code tags added. Link to comment https://forums.phpfreaks.com/topic/247627-please-help-sending-multiple-checkbox-using-php/ Share on other sites More sharing options...
Pikachu2000 Posted September 22, 2011 Share Posted September 22, 2011 When posting code, enclose it within the forum's . . . BBCode tags. Link to comment https://forums.phpfreaks.com/topic/247627-please-help-sending-multiple-checkbox-using-php/#findComment-1271623 Share on other sites More sharing options...
Pikachu2000 Posted September 22, 2011 Share Posted September 22, 2011 You're going to need to post the markup for the form (at least the checkboxes) also. That's probably where the problem lies. Link to comment https://forums.phpfreaks.com/topic/247627-please-help-sending-multiple-checkbox-using-php/#findComment-1271624 Share on other sites More sharing options...
bumblebee Posted September 22, 2011 Author Share Posted September 22, 2011 I don't understand >.< haha sorry I'm really new to php . Link to comment https://forums.phpfreaks.com/topic/247627-please-help-sending-multiple-checkbox-using-php/#findComment-1271625 Share on other sites More sharing options...
Pikachu2000 Posted September 22, 2011 Share Posted September 22, 2011 You don't understand which one? Link to comment https://forums.phpfreaks.com/topic/247627-please-help-sending-multiple-checkbox-using-php/#findComment-1271626 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.