john_zakaria Posted April 6, 2009 Share Posted April 6, 2009 hi everyone please i want to print the value of the variables $myradiobutton1 $myradiobutton2 $myradiobutton3 $myradiobutton4 ....... $myradiobutton10 i made a for loop to print the values of each $myradiobutton($i) but i can not print it ... can anyone help me the code is for($i = 1; $i < 11; $i++) { echo $myradiobutton.$i.'<Br><BR>'; } please try to fix this problem thnx in advance Link to comment https://forums.phpfreaks.com/topic/152763-problem-in-for-loop-php/ Share on other sites More sharing options...
Mark Baker Posted April 6, 2009 Share Posted April 6, 2009 You should really use an array for your radio buttons, it make things so much easier However for($i = 1; $i < 11; $i++) { $radioButtonName = 'myradiobutton'.$i; echo $$radioButtonName.'<br /><br />'; } Link to comment https://forums.phpfreaks.com/topic/152763-problem-in-for-loop-php/#findComment-802185 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.