Hi there,
I've made this page in html:
http://www.greenbeanbaby.com/retailers.php
with drop-down menus that work.

But when I try to make it dynamic for my client to update it, I'm stuck! The drop downs don't work.
Here is the code I'm using:

$r=mysql_query("SELECT * FROM retailer");
	$varloop=1;
	echo "<div id='wrap'>";
	while(list($idr, $name)=mysql_fetch_array($r)){
		//echo "$name";
		//echo "<br />";
			
		$r2=mysql_query("SELECT idp, provinces FROM province WHERE parentidr='$idr'") or die(mysql_error());
		while(list($idp, $provinces)=mysql_fetch_array($r2)){
			echo ("<span class='product-menu'>");
			echo "$provinces";
			echo ("</span>");
			echo ("<a href='#' id='example.$varloop.-show' class='showLink' onclick='showHide(example.$varloop);return false;'><img src='../images/retailer-down.gif' alt='retailer' width='10' height='8' class='img' /></a>");
			echo ("<div id='example.$varloop' class='more'><a href='#' id='example.$varloop.-hide' class='hideLink' onclick='showHide(example.$varloop);return false;'><img src='../images/retailer-up.gif' alt='retailer' width='10' height='8' class='img' /></a>");
			echo "<br />";
			$varloop++;
			//echo $varloop;
				
			$r3=mysql_query("SELECT idc, cities FROM city WHERE parentidp='$idp'") or die(mysql_error());
			while(list($idc, $cities)=mysql_fetch_array($r3)){
				echo ("<span class='bold'>");
				echo "$cities";
				echo ("</span>");
				echo "<br />";
					
				$r4=mysql_query("SELECT ids, stores, website, link, phone FROM store WHERE parentidc='$idc' AND parentidp='$idp'") or die(mysql_error());
				while(list($ids, $stores, $website, $link, $phone)=mysql_fetch_array($r4)){
					echo "$stores";
					echo " ";
					echo ("<a href='$link' target='_blank' class='second'>");
					echo "$website";
					echo ("</a>");
					echo " ";
					echo "$phone";
					echo "<br />";
				}			
	                }
		echo ("</div>");
		echo "<br /><br />";
		}
	}
		
	echo "</div>";

Can someone help me find my mistake please?

Thank you!

Recommended Answers

All 5 Replies

I looked at this site and I don't see any working drop-down menus.

I'm not prepared to spend the time doing the debugging that you need to do. Maybe someone else is but that may be why you don't have any responses yet. If you at least showed what was working and then specifically what you changed, there might be a chance that someone would spot something wrong in the changes.

Hi,
Thank you for the remark...

So I guess I did not explain properly: the drop-down are next to the provinces "Alberta"..., the little triangle that indicates 'down': this opens a list of stores. And you can find the html code by viewing the page source.
So you can compare the html code and the php code that is up here in my first post.

I hope this is enough new info.

Thank you for any help.

Help please!

I'm gonna close this discussion but I thought I would give you the answer, as I found it from a friend of mine:
Changes are in red

Line 13
echo ("<a href='#' id='example.$varloop.-show' class='showLink' onclick='showHide(example.$varloop);return false;'><img src='../images/retailer-down.gif' alt='retailer' width='10' height='8' class='img' /></a>");

Line 14
echo ("<div id='example.$varloop' class='more'><a href='#' id='example.$varloop.-hide' class='hideLink' onclick='showHide(example.$varloop);return false;'><img src='../images/retailer-up.gif' alt='retailer' width='10' height='8' class='img' /></a>");

Hope this can help some of you, unless my code is really bad anyway! At least it works for now!
Cheers

Member Avatar for diafol
Changes are in red

Well that certainly helps! :)

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.