mjurmann Posted March 16, 2008 Share Posted March 16, 2008 Hello, I'm trying to pass multiple checkbox values from a form to the next page (a mail script). Even when multiple checkboxes are selected, the e-mail sent out via the script on the form action's destination page only includes the last checked item. How can I include all of the checkbox values? Here is the code I was using on the mail script page: <?php if (is_array($_POST['program'])){ $TrainingProgram = implode(', ', $_POST['program']);} else { $TrainingProgram = $_POST['program']; }?> Thanks so much. Link to comment https://forums.phpfreaks.com/topic/96426-passing-multiple-form-checkbox-values-to-the-next-page/ Share on other sites More sharing options...
thebadbad Posted March 16, 2008 Share Posted March 16, 2008 All your check boxes should have the name "program[]" in order for your code to work. Link to comment https://forums.phpfreaks.com/topic/96426-passing-multiple-form-checkbox-values-to-the-next-page/#findComment-493516 Share on other sites More sharing options...
mjurmann Posted March 16, 2008 Author Share Posted March 16, 2008 You. Are. Awesome. Thank you so much! Link to comment https://forums.phpfreaks.com/topic/96426-passing-multiple-form-checkbox-values-to-the-next-page/#findComment-493520 Share on other sites More sharing options...
thebadbad Posted March 16, 2008 Share Posted March 16, 2008 Of course I am, I knew you missed the brackets without even seeing your HTML! Link to comment https://forums.phpfreaks.com/topic/96426-passing-multiple-form-checkbox-values-to-the-next-page/#findComment-493525 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.