I use a javascript to help me with bigger dropdowns... <script> function get_links() { document.all["field_name"].value='<?echo"$field_name"; ?>' </script>
"Torsten Roehr" <[EMAIL PROTECTED]> 28/05/2004 16:12 To [EMAIL PROTECTED] cc Subject Re: [PHP] making selection in drop down "Alex Hogan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > > Use HTML attribute "selected" in the option field you want to > > set as default... > > Yes.., thank you.., however I am more interested in how to force that selection to a specific option tag in the dropdown from a search. If I'm missing your point please excuse me. I'm a little brain dead this morning. > > If I have something like this what I'll want to do is to identify the point in the array where I can force the selected to be the default based on the previous search. > > <select name="sellocation" class="body_text" id="sellocation"> > <option value="0" <?=$option[0]?>>Make Selection</option> > <? > $i = 1; > while($row = mssql_fetch_array($result)) > { > $v = $row['loc_id']; > $n = $row['loc_city']; > echo "<option value=\"$v\" $option[$i]>$n</option>"; > } Try this: while ($row = mssql_fetch_array($result)) { $v = $row['loc_id']; $n = $row['loc_city']; echo "<option value=\"$v\" "; // if current loc_id is previously selected loc_id set selected echo ($_POST['sellocation'] == $v) ? 'selected' : ''; echo "$option[$i]>$n</option>"; } Regards, Torsten Roehr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ********************************************************************* The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *********************************************************************** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php