jkkenzie Posted October 28, 2008 Share Posted October 28, 2008 I have this code that generates fields: $order=0; $count2=1; while($order < $count) { echo "<input type='checkbox' name='".$country[$order]."' value = ' ".$count2."'>".$country[$order]. "<br />"; $order++; $count2++; } I would like to get checked checkboxes values to variables into code below: <?php if (isset($_POST['continue'])) { //I need to have the checked values to variables here } ?> any help? Link to comment https://forums.phpfreaks.com/topic/130414-solved-get-post-fileds/ Share on other sites More sharing options...
MadTechie Posted October 28, 2008 Share Posted October 28, 2008 okay.. first change echo "<input type='checkbox' name='".$country[$order]."' value = ' ".$count2."'>".$country[$order]. "<br />"; to echo "<input type='checkbox' name='myorders[]' value = ' ".$count2."'>".$country[$order]. "<br />"; myorders can be anything just make sure you have the brackets [] now to display <?php if (isset($_POST['continue'])) { //I need to have the checked values to variables here foreach($_POST['myorders'] as $mo) { //only the check boxes appear echo "$mo<br>"; } } ?> *untested but should be fine Link to comment https://forums.phpfreaks.com/topic/130414-solved-get-post-fileds/#findComment-676480 Share on other sites More sharing options...
jkkenzie Posted October 28, 2008 Author Share Posted October 28, 2008 Thanks it worked. regards, Joseph Link to comment https://forums.phpfreaks.com/topic/130414-solved-get-post-fileds/#findComment-676502 Share on other sites More sharing options...
MadTechie Posted October 28, 2008 Share Posted October 28, 2008 cool can you click solved topic please (saves people turning up to help and learning the party has finished) Link to comment https://forums.phpfreaks.com/topic/130414-solved-get-post-fileds/#findComment-676509 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.