Link to home
Start Free TrialLog in
Avatar of aegirbrands
aegirbrands

asked on

Creating sticky select form field using $_GET[] details.

Probably quite simple but I cant seem to get this working.

I just want the select field to pre-select the $_GET[s_display] value when this is present.

Any help is much appriciated.

*****************************************************************

<select name="s_display">';
   <?php
   $display_number = array (2,5,10,20,30,50,100);
    foreach ($display_number as $key => $value) {
      echo "<option value=\"$key\"";
      if (isset($_GET['s_display']))  {
      echo "selected=\"selected\"";
      }
      echo ">$value</option>\n";
}?>
</select>
ASKER CERTIFIED SOLUTION
Avatar of Joseph Melnick
Joseph Melnick
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of aegirbrands
aegirbrands

ASKER

Thank you, just what I needed.