Jump to content

Drop down form order of choices?


Thundarfoot

Recommended Posts

This form gets its choices from a table, except for first default choice ALL which is manual.

Is there a way to make the form default to a choice from the table, but still have the manual choice of All in the list?

 

Reason I want to do this is that currently when the page loads the default is to show all records this can be a waste of bandwith and time if user doesnt need to see All....here is the code...

Any help is very much appreciated.

Link to comment
https://forums.phpfreaks.com/topic/86685-drop-down-form-order-of-choices/
Share on other sites

 

<form id="form1" name="form1" method="post" action="">

  <label>Class

  <select name="select">

  <option value="">ALL</option>

    <?php

do { 

?>

    <option value="<?php echo $row_Class['Class']?>"><?php echo $row_Class['Class']?></option>

    <?php

} while ($row_Class = mysql_fetch_assoc($Class));

  $rows = mysql_num_rows($Class);

  if($rows > 0) {

      mysql_data_seek($Class, 0);

  $row_Class = mysql_fetch_assoc($Class);

  }

?>

  </select>

  </label>

<input type="submit" name="submit" value="submit">

</form>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.