JohneeMac Posted March 17, 2006 Share Posted March 17, 2006 Hi i want the checkboxes selected to be sent to my mail account. The email part works fine but i just cant get these checkboxes to be included.[code]<input type="checkbox" name="foo[]" class="no" id="fishing" value="Fishing" "/><input class="no" name="foo[]" type="checkbox" id="quadBiking" value="Quad Biking" /> <input class="no" name="foo[]" type="checkbox" id="gameShooting" value="Game Shooting/>[/code][code]$foo = $_POST['foo'];if (count($foo) > 0) { for ($i=0;$i<count($foo);$i++) { $actos .= "$foo[$i]\n"; } } [/code]Any help greatly appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/5189-getting-checkboxes-ticked-to-email/ Share on other sites More sharing options...
kenrbnsn Posted March 17, 2006 Share Posted March 17, 2006 You didn't include the code you're using to send the email.An easier way to get the values from the check boxes:[code]<?php if (isset($_POST['foo'])) actos = implode("\n",$_POST['foo'])."\n"; ?>[/code]Ken Quote Link to comment https://forums.phpfreaks.com/topic/5189-getting-checkboxes-ticked-to-email/#findComment-18417 Share on other sites More sharing options...
JohneeMac Posted March 17, 2006 Author Share Posted March 17, 2006 Thanks for the reply Ken.I put in the code as you said but its still not workingi have :[code]mail($recipient, $subject, "\n Group Number: $group \n\n Activities: $actos \n\n Message:$msg ", $headers);[/code] for sending mailand [code] if (isset($_POST['foo'])) $actos = implode("\n",$_POST['foo'])."\n";[/code]for getting the variables.Thanks for your help Quote Link to comment https://forums.phpfreaks.com/topic/5189-getting-checkboxes-ticked-to-email/#findComment-18427 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.