Drop Down Navigation in Php…

Hi All,

Merry Christmas to everyone!

I would like to know how to create a drop down navigation (html form) that lists some text like link1 link2 link3 etc..And each one of those ‘links’ in the drop down navigation would link to the result of a mysql query.

For example here is my query:

PHP Code:


$query="select ad_type, banner from amp_ads WHERE ad_type=1"
$result=mysql_query($query);

while ($row=mysql_fetch_array($result)) { 

echo "<img src='$row[banner]'>";






I would like to take the results of the query and have that as the link to each of the text links in the drop down menu.

How is that accomplished? Sorry if that seems so basic, I’ve been having php nightmares lately…Trying to get through them with as little pain as possible.

The idea would be to have each link in the drop down goto a different ad_type as the query currently shows the Where clause as ad_type=1, but the other text in the drop down list would go to ad_type=2 3 4 5 etc without having to code a separate query for each link in the drop down. Note: The ad_type part may not be in the order as shown, maybe like link 1 maybe ad_type=1 and link 2 might be ad_type=5 as an example.

Here’s the basic idea of the drop down menu: Note: I quickly copied/pasted the code below.

HTML Code:

<html>
<body>
<form action="dummy" method="post"><select name="choice" size="1" onChange="jump(this.form)"><option value="">Choose a Link</option><option value="#">Standard Banners</option><option value="#">Half Size Banners</option><option value="">------</option><option value="#">Standard Buttons</option><option value="#">Mini Buttons</option></select></form>
</body>
</html>


Thank you!
-Brian

View full post on Tycoon Talk

, , ,

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Get Adobe Flash playerPlugin by wpburn.com wordpress themes


RSS Site FeedRSS Site Feed

© 1992-2011 DC2NET™, Inc. All Rights Reserved