Hello, a quick question.
If you have a PHP dynamic dropdown menu (that autopopulates with info from a mysql table), then the menu automatically links to its values, i.e. "page.php?value1=value1", correct?

If you have two dropdown menus, then it becomes "page.php?value1=value1&value2=value2".

Is there any way to make the dropdowns link to an absolute url? For example, instead of "page.php?value1=value1", it becomes "page/value1", etc.

I know that there is Apache mod_rewrite involved, and I am NOT asking about the rewrite (I am well aware of how to do this); I am asking about making the dropdowns link to whatever URL I wish it to link to when wrapped in a PHP code.

I have tried just making the value in my select menu the url, but then it turns into "page.php?value1=http://site.com/page/value1" which obviously neither works nor is what I want it to do.

Recommended Answers

All 2 Replies

perhaps change the way the selects are handled,
drop down menus don't really need to be handled as a form, the drop down menus above these posts(daniweb) are css-styled <ul>
given the value() arrays, url1 url2 etc the pages all you requre is to populate <ul><li> from the database, and let the css handle the appearance
anyhow the google search would be "css dropdown menu"
how the database values are passed as urls depends on how they are stored
ignoring code errors, code to select and loop through database values is completely ignored

<ul>
<?php echo "<li><a href='http:/mysite.com/$database_url_value1'>$database_text_value1</a></li>"; ?>
//loop
</ul>

just a posssiblity

Hi almostbob,
Thank you for replying to my thread.

I'm well aware of the possibility of using css dropdown menus, however I am looking for a form because I plan on having the values submitted through a (search) form.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.