Jump to content

Archived

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

JohneeMac

How do i get checkboxes to email?

Recommended Posts

Hi there.

How do i get checkbox values sent to my email account?

I have other variables that send fine like name, email etc and the mail () function works fine.

I would like to get checkboxes working though.

I have 6 activities such as quad biking, off road driving etc and how can i send these names if selected to my email account?

Thanks for your time.

Share this post


Link to post
Share on other sites
[!--quoteo(post=356448:date=Mar 19 2006, 06:51 PM:name=JohneeMac)--][div class=\'quotetop\']QUOTE(JohneeMac @ Mar 19 2006, 06:51 PM) [snapback]356448[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Hi there.

How do i get checkbox values sent to my email account?

I have other variables that send fine like name, email etc and the mail () function works fine.

I would like to get checkboxes working though.

I have 6 activities such as quad biking, off road driving etc and how can i send these names if selected to my email account?

Thanks for your time.
[/quote]


This probs sounds really basic but do you have the values set fot the checkboxes?

Share this post


Link to post
Share on other sites
Unchecked checkboxes have the value off, and checked have the value on. You do not need to define any values in the actual <input type="checkbox" etc> tag.

In the $subject, or whatever use this:

[code]
if($checkbox_variable == "on"){
echo "Checkbox: Yes";}
else{
echo "Checkbox: No";
}
[/code]

Or replace Yes/No with whatever the checkbox is concerning...

Hope it helps.

Share this post


Link to post
Share on other sites
Is there a cleaner method without all the "if" and "else" statements?

I currently have 6 options but might be expanding them.

Thanks for replies so far.

Share this post


Link to post
Share on other sites
No, but if there is only one option you care about ie wether the checkbox is checked, then echo Checkbox: Yes, but if it isnt checked, then dont display anything you could just do

[code]
if($checkbox_variable == "on"){
echo "Checkbox: Yes";}
[/code]

...with no else statement

Thats about as short as it gets


Try it.

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.