Jump to content

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.
Link to comment
https://forums.phpfreaks.com/topic/5305-how-do-i-get-checkboxes-to-email/
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?
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.
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.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.