Jump to content


Photo

Getting checkboxes ticked to email


  • Please log in to reply
2 replies to this topic

#1 JohneeMac

JohneeMac
  • Members
  • Pip
  • Newbie
  • 9 posts

Posted 17 March 2006 - 08:37 PM

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.



<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/>




$foo = $_POST['foo'];
if (count($foo) > 0) {
     
     for ($i=0;$i<count($foo);$i++) {

            $actos .= "$foo[$i]\n";

     } 

} 




Any help greatly appreciated.

#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 17 March 2006 - 08:47 PM

You didn't include the code you're using to send the email.

An easier way to get the values from the check boxes:
<?php if (isset($_POST['foo'])) actos = implode("\n",$_POST['foo'])."\n"; ?>

Ken

#3 JohneeMac

JohneeMac
  • Members
  • Pip
  • Newbie
  • 9 posts

Posted 17 March 2006 - 09:50 PM

Thanks for the reply Ken.

I put in the code as you said but its still not working

i have :

mail($recipient, $subject, "\n Group Number: $group \n\n Activities: $actos \n\n Message:$msg ", $headers);
for sending mail

and

if (isset($_POST['foo'])) $actos = implode("\n",$_POST['foo'])."\n";

for getting the variables.

Thanks for your help




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users