Monkuar Posted September 3, 2012 Share Posted September 3, 2012 for instance: <select name="q1"> for ($numbers=1; $numbers<=160; $numbers++){ $numbers2 = mt_rand(1,160); echo "<option value={$numbers2}>{$numbers2}</option>"; } </select> I need to make it so, everytime this runs, it will always show the number "80" in the loop, every single time. Definitely hope this is possible. If you're wondering why, well because I am making this fun quiz and wants users to get annoyed by checking a dropdown list for the correct answer. Pretty much, need to show the number "80" in their, everytime this code executes Quote Link to comment https://forums.phpfreaks.com/topic/267958-mt_rant-favorible-number/ Share on other sites More sharing options...
Pikachu2000 Posted September 3, 2012 Share Posted September 3, 2012 Huh? Why even use mt_rand if you want the same number every time? Quote Link to comment https://forums.phpfreaks.com/topic/267958-mt_rant-favorible-number/#findComment-1374920 Share on other sites More sharing options...
Monkuar Posted September 3, 2012 Author Share Posted September 3, 2012 <select> <?php $numlist = range(1, 160); shuffle($numlist); foreach ($numlist as $mynumbers){ echo '<option> '.$mynumbers.'</option>'; } ?> </select> marked as solved.. sorry brainfart Quote Link to comment https://forums.phpfreaks.com/topic/267958-mt_rant-favorible-number/#findComment-1374924 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.