Hyperlinks in drop down menu

Everything looks clean. I don’t see any hyperlink mechanism in this code. I’m not that familiar with your method, so I might be missing something. Thx

The onchange event in the select below, fires off the javascript…

[php] echo ‘’;[/php]

This is the javascript, it changes the window.location to the value in the option.

[php][/php]

Yeah, I just figured that out. Thanks. I think the problem is in the last echo line before the

I have replaced cat with catid and id but nothing…

Thoughts?

As soon as that window.location fires, it should change your url. Does that happen?

Oddly enough, it does…? But the page is the same… The catid changes in the url. Just like it should. But the page itself stays the same.

that’s because you’re telling it to go to the index.php page everytime…

[php]value="index.php?content=buyproducts&cat=[/php]

Changing the catid, just changes the querystring parameter… It doesn’t change the page it’s calling.

But it worked before. I have the index page set up to have a header, footer and main section. The main section is the part that changes when a hyperlink is selected from the dropdown. It pulls in the buyproducts page with the products displayed instead of the main section now that has the dropdown menu in it…

It probable does something different based on the querystring…

Is there any $_GET[‘Cat’] ir $_GET[‘CatID’] or $_POST?

[php]<?php
$catid = $_GET[‘cat’];

$query=“SELECT name from categories WHERE catid = $catid”;
$result = mysql_query($query);
$row=mysql_fetch_array($result, MYSQL_ASSOC);
echo “

<font color=>
{$row[‘name’]} - Click here

\n”;

if (!isset($_GET[‘page’]))
$page = 1;
else
$page = $_GET[‘page’];

showproducts($catid, $page, “index.php?content=buyproducts”, “index.php?content=updatecart”);
?>[/php]

[php] $catid = $_GET[‘cat’];[/php]

Then you should leave it as cat!

It is cat, just not jumping to the hyperlinked page. Thanks. May sign off for the night shortly. Thanks again.

It is jumping to the right page index.php, it’s just not getting falling into the right area in the index.php to trigger the code you want, if you posted all your code I can be of more help.

Okay. And thanks to you guys helping so far. I have the layout of the items in the drop down menu. But when I select one, the page does not change.

This is buyproducts.inc.php

[php]<?php
$catid = $_GET[‘cat’];

$query=“SELECT name from categories WHERE catid = $catid”;
$result = mysql_query($query);
$row=mysql_fetch_array($result, MYSQL_ASSOC);
echo “

<font color=>
{$row[‘name’]} - Click to learn more

\n”;

if (!isset($_GET[‘page’]))
$page = 1;
else
$page = $_GET[‘page’];

showproducts($catid, $page, “index.php?content=buyproducts”, “index.php?content=updatecart”);
?>[/php]

This is index.php

[php]<?php
session_start();
?>

hidden <?php include("mylibrary/login.php"); include("mylibrary/showproducts.php"); include("mylibrary/showproducts2.php"); include("mylibrary/showproducts3.php"); include("mylibrary/showproducts4.php"); include("mylibrary/showproducts5.php"); login(); ?>
<?php include("mobileheader.inc.php"); ?>
<?php include("main.inc.php"); ?>
<?php include("footer.inc.php"); ?>
[/php]

And this is the nav.inc.php page that contains the links in the drop down menu that don’t make the page change that causes my main issue now. Thanks for all your help!

[php]

<?php $query="SELECT catid,name from categories ORDER BY name"; $result=mysql_query($query); echo ''; while($row=mysql_fetch_array($result,MYSQL_ASSOC)) { $catid = $row['catid']; $name = $row['name']; $query2="SELECT count(prodid) FROM products WHERE catid = $catid"; $result2 = mysql_query($query2); $row=mysql_fetch_array($result2); $total = $row[0]; echo '' . $name . '(' . $total . ')'; } echo ""; ?>[/php]

What’s in the “mylibrary/showproducts.php 1-5”?

They get and display items by category or type or owner etc thay are virtually all the same thing but only one applies in this problem since I am using catid or get and sort by category

Can you show me one of them, cause I’m looking for something I’m not seeing in the other pieces of code you posted.

[php]<?php
function showproducts($catid, $page, $currentpage, $newpage)
{
$query = “Select count(prodid) from products where catid = $catid”;
$result = mysql_query($query);
$row = mysql_fetch_array($result);
if ($row[0] == 0)
{
echo “


Sorry, there are no entrees in this category\n”;
}
else
{
$thispage = $page;
$totrecords = $row[0];
$recordsperpage = 5;
$offset = ($thispage - 1) * $recordsperpage;
$totpages = ceil($totrecords / $recordsperpage);
     echo "<h3><table bordercolor=\"\" width=\"500\" cellpadding=\"3\" border=\"0\">\n";


     //echo "<tr><td>Image</td>\n";
     //echo "<td>Name</td>\n";
     //echo "<td>Price</td>\n";
     //echo "<td>etc</td>\n";
 //echo "<td>etc</td>\n";
     //echo "<td>etc</td>\n";
   

     $query = "SELECT * from products WHERE catid=$catid LIMIT $offset,$recordsperpage";
     $result = mysql_query($query);
     while($row=mysql_fetch_array($result, MYSQL_ASSOC))
     {
        $prodid = $row['prodid'];

// $description = $row[‘description’];
$description = substr(stripslashes($row[‘description’]), 0, 25);
$price = $row[‘price’];
// $name = $row[‘etc–etc–etc code altered beta test’];

//-----------------------------------starts records display--------first row—

echo “<tr bordercolor=”">\n";
echo “<tr border=“1”><tr bgcolor=”">\n";
echo “<td border=“0” cellborder=“0”>
<img src=“showimage.php?id=$prodid” width=“80” height=“60”>
<a href=“index.php?&content=updatecart&id=$prodid”>$name$ $price
\n”;

        echo "</td><td width=\"250\"><center>$description<br><br></center><center>$name<br></center><center>$etce<br></center></td></tr>\n";

echo “\n”;
echo “\n”;
//------end of first column in first row-----------

}

// Code to implement paging below this line
if ($thispage > 1)
{
$page = $thispage - 1;
$prevpage = “<a href=”$currentpage&cat=$catid&page=$page">Previous page";
} else
{
$prevpage = " ";
}

     if ($thispage < $totpages)
     {
        $page = $thispage + 1;
        $nextpage = " <a href=\"$currentpage&cat=$catid&page=$page\">Next page</a>";
     } else
     {
        $nextpage = " ";
     }

     if ($totpages > 1)
        echo $prevpage . "  " . $nextpage;

echo “\n”;
}
}
?>[/php]

Thoughts anyone? Thanks.

Where is this page being included [php]buyproducts.inc.php[/php]? I don’t see where it’s called from.

Line 20 on the nav page

Sponsor our Newsletter | Privacy Policy | Terms of Service