zartzar Posted March 3, 2009 Share Posted March 3, 2009 This basically creates a table with a for loop, with 10 rows, and within each of that row is a for loop generated drop down menu that goes from 0 - 50000, however i cant get the drop down menu to work. I dont even get any errors, its just blank. Im tearing my hair out!!!!!! print "<table border='1'>"; for($c=1; $c<=10; $c++) { print "<tr> <td>$c</td> <td><input type='text' name='$c' size='20'></td> <td>R <select name='valincome'> for($cc=0; $cc<=50000; $cc=$cc+100) { <option value='$cc'>$cc</option> } </select> </td> </tr>"; } print "</table>"; Quote Link to comment https://forums.phpfreaks.com/topic/147825-loops-making-me-crazy-again/ Share on other sites More sharing options...
samshel Posted March 3, 2009 Share Posted March 3, 2009 <?php print "<table border='1'>"; for($c=1; $c<=10; $c++){ print "<tr> <td>$c</td> <td><input type='text' name='$c' size='20'></td> <td>"; print "<select name='valincome'>"; for($cc=0; $cc<=50000; $cc=$cc+100){ print "<option value='$cc'>$cc</option>"; } print "</select> </td> </tr>"; } print "</table>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/147825-loops-making-me-crazy-again/#findComment-775893 Share on other sites More sharing options...
premiso Posted March 3, 2009 Share Posted March 3, 2009 Going a little loopy are we? print "<table border='1'>"; for($c=1; $c<=10; $c++) { print "<tr> <td>$c</td> <td><input type='text' name='$c' size='20'></td> <td> <select name='valincome'>"; for($cc=0; $cc<=50000; $cc=$cc+100) { print "<option value='$cc'>$cc</option>"; } print "</select> </td> </tr>"; } print "</table>"; You should really learn the Basic Syntax of php, as it shows you are really lacking on that knowledge. EDIT: Beaten to it Quote Link to comment https://forums.phpfreaks.com/topic/147825-loops-making-me-crazy-again/#findComment-775894 Share on other sites More sharing options...
zartzar Posted March 3, 2009 Author Share Posted March 3, 2009 <?php print "<table border='1'>"; for($c=1; $c<=10; $c++){ print "<tr> <td>$c</td> <td><input type='text' name='$c' size='20'></td> <td>"; print "<select name='valincome'>"; for($cc=0; $cc<=50000; $cc=$cc+100){ print "<option value='$cc'>$cc</option>"; } print "</select> </td> </tr>"; } print "</table>"; ?> Sams the man! So your saying i shouldnt put for loops in print statements? Quote Link to comment https://forums.phpfreaks.com/topic/147825-loops-making-me-crazy-again/#findComment-775898 Share on other sites More sharing options...
samshel Posted March 3, 2009 Share Posted March 3, 2009 u cannot !!..please go through the link given by premiso..u cannot put logic inside print statement. Quote Link to comment https://forums.phpfreaks.com/topic/147825-loops-making-me-crazy-again/#findComment-775900 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.