Pavlos1316 Posted June 1, 2008 Share Posted June 1, 2008 hi I have a form with 3 check boxes chkbox 1 chkbox 2 chkbox 3 id home 1 home2 home3 user can check lets say box 1 i know how to automaticaly sent an email to the user. my question is... Can I sent him the checkbox id, in this case "home1", also? Quote Link to comment https://forums.phpfreaks.com/topic/108281-email-results/ Share on other sites More sharing options...
timmah1 Posted June 1, 2008 Share Posted June 1, 2008 Just echo out the checkbox in the email $_POST['chkbox1']; Quote Link to comment https://forums.phpfreaks.com/topic/108281-email-results/#findComment-555115 Share on other sites More sharing options...
Pavlos1316 Posted June 1, 2008 Author Share Posted June 1, 2008 yes but I don't now which one the user will choose... how do I figure that out? Should I echo all checkboxes but still user will see only those who checked? Plus... I echo the checkbox's id, name or value or it doesn't matter? Quote Link to comment https://forums.phpfreaks.com/topic/108281-email-results/#findComment-555120 Share on other sites More sharing options...
.josh Posted June 1, 2008 Share Posted June 1, 2008 You can make a condition to check for each one or you can make an array. The id is not necessary for php. The name is what you would echo, and it will echo the value. Quote Link to comment https://forums.phpfreaks.com/topic/108281-email-results/#findComment-555123 Share on other sites More sharing options...
Pavlos1316 Posted June 1, 2008 Author Share Posted June 1, 2008 ok.. cause I am not good at this... basically I'm new.. can you show me how?? Quote Link to comment https://forums.phpfreaks.com/topic/108281-email-results/#findComment-555128 Share on other sites More sharing options...
tapos Posted June 1, 2008 Share Posted June 1, 2008 try bellow <input type="checkbox" name="checkbox[]" value="<?php echo $checkbox1['id']?>" > <input type="checkbox" name="checkbox[]" value="<?php echo $checkbox2['id']?>" > <input type="checkbox" name="checkbox[]" value="<?php echo $checkbox3['id']?>"> Now you just can get checked checkbox values that means the id suppose 'home1' in the $_POST['checkbox'] array. like bellow: if 1st checkbox is selected then after submitting the value of $_POST['chekbox'] will be array( 0 => 'home1' ) hope this will help u. Quote Link to comment https://forums.phpfreaks.com/topic/108281-email-results/#findComment-555137 Share on other sites More sharing options...
Pavlos1316 Posted June 1, 2008 Author Share Posted June 1, 2008 so.. 1st i change chkbox value - ok 2nd as i see it i write an array for each one of them - ? (I do it inside the email or anywhere?) 3rd what if the user checks 2 boxes? how do i determine that? or when i write the arrays what ever is checked it will be displayed? what 0 stants for? it means i continue 1=> home2 etc? Quote Link to comment https://forums.phpfreaks.com/topic/108281-email-results/#findComment-555150 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.