clankill3r Posted October 6, 2011 Share Posted October 6, 2011 First of all i create the page to copy the buttons as pixels to paste into a design, it's not for a working webpage. It goes wrong here, <option value="0">Day</option> <?= for(var i=0; i<31; i++){?> <option value="<?=i?>"><?=i?></option> <?= } ?> </select> <?php ?> <html> <head> <title>Community Development Project</title> </head> <body> <div id="container"> <form id="opties1" name="opties1" method="post" action="something.php"> <div class="forminput"> <input type="button" id="signin" name="signin" value="Sign In" /> <br/> <br/> <input type="button" id="register" name="register" value="Register" /> <br/> <br/> <input type="button" id="uploadimage" name="uploadimage" value="Upload Image" /> <br/> <br/> <input type="button" id="next" name="next" value="Next" /> <br/> <br/> <input type="button" id="addanother" name="addanother" value="Add Another" /> <br/> <br/> <input type="button" id="register" name="register" value="Register" /> <br/> <br/> <input type="button" id="create" name="create" value="Create" /> <br/> <br/> <input type="button" id="addfolder" name="addfolder" value="Add Folder" /> <br/> <br/> <input type="button" id="addimage" name="addimage" value="Add Image" /> <br/> <br/> <input type="button" id="addtask" name="addtask" value="Add Task" /> <br/> <br/> <input type="button" id="cancel" name="cancel" value="Cancel" /> <br/> <br/> <input type="button" id="watch" name="watch" value="Watch" /> <br/> <br/> </div> </form> <form id="opties2" name="opties2" method="post" action="something.php"> <div class="forminput"> <select id="day" name="day"> <option value="0">Day</option> <?= for(var i=0; i<31; i++){?> <option value="<?=i?>"><?=i?></option> <?= } ?> </select> <select id="country" name="Country"> <option value="0">Netherlands</option> <option value="1">Germany</option> <option value="2">Belgium</option> </select> </div> </form> </div> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/248577-a-for-loop-in-a-page-to-create-values/ Share on other sites More sharing options...
Buddski Posted October 6, 2011 Share Posted October 6, 2011 You cannot use the <?= in the way you have, <?= is an ECHO shortcut. You also seem to be using a more Javascript variable style Variables are preceded with a $ and do not require the 'var' part. Try this <option value="0">Day</option> <?php for($i=0;$i<31;$i++){ ?> <option value="<?=$i?>"><?=$i?></option> <?php } ?> </select> Quote Link to comment https://forums.phpfreaks.com/topic/248577-a-for-loop-in-a-page-to-create-values/#findComment-1276571 Share on other sites More sharing options...
clankill3r Posted October 6, 2011 Author Share Posted October 6, 2011 Thanks, and i'm more used to java and a bit to javascript Quote Link to comment https://forums.phpfreaks.com/topic/248577-a-for-loop-in-a-page-to-create-values/#findComment-1276598 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.