Jump to content

Archived

This topic is now archived and is closed to further replies.

JohneeMac

Getting checkboxes ticked to email

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Thanks for the reply Ken.

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

i have :

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

and

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

for getting the variables.

Thanks for your help

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.