JohneeMac Posted March 19, 2006 Share Posted March 19, 2006 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 Link to comment Share on other sites More sharing options...
aaronrb Posted March 19, 2006 Share Posted March 19, 2006 [!--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? Quote Link to comment Share on other sites More sharing options...
Spixxx Posted March 19, 2006 Share Posted March 19, 2006 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. Quote Link to comment Share on other sites More sharing options...
JohneeMac Posted March 19, 2006 Author Share Posted March 19, 2006 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. Quote Link to comment Share on other sites More sharing options...
Spixxx Posted March 19, 2006 Share Posted March 19, 2006 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 statementThats about as short as it getsTry it. Quote Link to comment 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.