By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,197 Members | 1,151 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,197 IT Pros & Developers. It's quick & easy.

using Select tag to populate dynamic list - but how to make those list items links?

P: 2
I'm using the select tag to populate a dynamic list of work categories from our database. I accomplished this just fine but how do I now make those list items link to the corresponding pages?

ie. Click on Accounting and populate a page with only those members in the accounting field.

Expand|Select|Wrap|Line Numbers
  1. <div id="Categories"><select name="list" size="105">
  2.     <?php
  3. do {  
  4. ?>
  5.     <option value="<?php echo $row_RS_Categories['ID']?>"<?php if (!(strcmp($row_RS_Categories['ID'], urlencode($row_RS_Categories['Categories'])))) {echo "selected=\"selected\"";} ?>><?php echo $row_RS_Categories['Categories']?></option>
  6.     <?php
  7. } while ($row_RS_Categories = mysql_fetch_assoc($RS_Categories));
  8.   $rows = mysql_num_rows($RS_Categories);
  9.   if($rows > 0) {
  10.       mysql_data_seek($RS_Categories, 0);
  11.       $row_RS_Categories = mysql_fetch_assoc($RS_Categories);
  12.   }
  13. ?>
  14.   </select>
  15.   </div>
Oct 11 '11 #1
Share this Question
Share on Google+
5 Replies


Dormilich
Expert Mod 5K+
P: 8,639
not at all (at least not with HTML only). for that to work you have two options
- submit the form and within PHP redirect to the appropriate page
- use JavaScript to change the action attribute of the form so that the submit takes you to the desired destination
Oct 12 '11 #2

P: 2
it's not in a form, just a div/select box that pulls up the list of categories. I want to format it so when you click on one of the categories it takes you to a page populated with only the members with that field selected.
Oct 12 '11 #3

Dormilich
Expert Mod 5K+
P: 8,639
it's not in a form
if it’s a <select>, it has to be inside a <form>, otherwise your HTML is invalid.

if you insist on not using forms, try a CSS Dropdown Menu (e.g. the Suckerfish Dropdown)
Oct 13 '11 #4

P: 59
i suggest AJAX i ve used it several times for stuffs like that gives u double advantage loads faster and works for u
Oct 13 '11 #5

Dormilich
Expert Mod 5K+
P: 8,639
I doubt that for this case.
Oct 13 '11 #6

Post your reply

Sign in to post your reply or Sign up for a free account.