View Single Post
  #2 (permalink)  
Old 03-01-2008, 10:35 PM
ryanhellyer's Avatar
ryanhellyer ryanhellyer is offline
Super Moderator
 
Join Date: Dec 2007
Posts: 708
Default

Okay, I've nutted out a crude fix for it that seems to do the job. It could get a little messy once I have a couple of hundred options on the page, but it will do the job.

PHP Code:
<form method="post" action="index.php">
    <select name="bla">
        <?php
            
if ($bla == "Red") {echo '<option>Red</option><option>Green</option><option>Blue</option>';}
            elseif (
$bla == "Green") {echo '<option>Green</option><option>Red</option><option>Blue</option>';}
            elseif (
$bla == "Blue") {echo '<option>Blue</option><option>Red</option><option>Green</option>';}
            else {echo 
'<option>Red</option><option>Green</option><option>Blue</option>';}
        
?>
    </select>
    <input type="submit" name="Submit" />
</form>

<?php    $bla $_POST['bla']; ?>

<p>You chose the "<?php echo $bla?>" option</p>

Is there a better way of doing this?

Also, if the user refreshes the page, the options go back tot he default. Is there a way to save this data? Perhaps on a per IP basis?
Reply With Quote