Jump to content

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>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.