Jump to content

Select default


KingOfHeart

Recommended Posts

I have a few dropdown forums and would like it to select the current values that are requested.

 

global $filename,$fileid,$filetype,$filedir,$fileby;
  global $months,$pg;	


echo "<h2>Search Files</h2>";
echo "<p>";	
  echo "<form name = 'File_Search' action = '#' method = 'POST'>";	
echo "<table border=\"0\" width=\"100%\"><tr>";
echo "<td>File Name<br><input type = 'text' name = 'name'></td><td>File Type<br><select name = 'type'>
<option value = '0'>All Types</option>
  <option value = 'o'>Official Files</option>
<option value = '1'>Quests</option>
  <option value = '2'>Graphic/Spritesheets</option>
  <option value = '3'>Entity/Scripts</option>	
  <option value = '4'>Sound/Music</option>	
  <option value = '5'>QuestPack/Programs</option>
  <option value = '6'>Miscellaneous</option>	
  </select></td>";
  echo "<td>Order By<br><select name = 'order'>
  <option value = '0'>Last Updated</option>
  <option value = '1'>ID</option>	
  <option value = '2'>Name</option>
  <option value = '3'>Downloads</option>
  <option value = '4'>Rating</option>	
<option value = '5'>Points</option>
  <option value = '6'>Random</option>	
  </select></td>";
  echo "<td>Acending?<br><select name = 'dir'><option value = '0'>False</option><option selected value = '1'>True</option></select></td>";
echo "</tr><tr><td rowspan = '4'><input type = 'submit' name = 'search' value = 'search'></td></tr></table></form>";
echo "</p>";

 

So if the $filetype equals 2 I want the dropdown box to show "Graphic/Spritesheets" by default. BTW Official Files is not actually a type so that's why I chose to give it a small letter o and will work the same way as All Types but run a different function.

 

$fileby is used for the OrderBy field.

$filedir is for the Acending field.

The other data is for the other parts of the script.

 

If you like you can give advice on the name's default because you may have a better method then what I have in my head.

Link to comment
Share on other sites

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.