Jump to content

making a localhost/page.php?....... url help!


david-remone123

Recommended Posts

At the moment, my website is very basic and outputs the following on the page localhost/product-catalogue.php:

 

echo "<font color=\"white\"><u>$productName</u></b><br><br>$productLine<br><br></font>"; 
echo "<img alt=\"product image\" width=\"250\" height=\"265\" src=\"images/".$image." \"/>"; 
echo "<font color=\"white\"></br><u>Product Description</u><br><br>$productDescription<br><br>£$sellPrice<hr color='gray' width='35%'></hr><br></font>";

 

I want to be able to click the image that is displayed, and then this will take you to localhost/product-catalogue.php?(productCode), so that I can add these products to a basket.

 

Could someone please explain how I would do this, as i have tried and been unsuccessful.

 

Thankyou.

Link to comment
https://forums.phpfreaks.com/topic/157120-making-a-localhostpagephp-url-help/
Share on other sites

Wrap the image in an anchor tag.

 

Ahh i got it to work eventually.

 

echo "<font color=\"white\"><u>$productName</u></b><br><br>$productLine<br><br></font>";
echo '<a href="product-catalogue.php?ProductID='.$productCode.'"><img src="images/'.$image.'" width="250" height="265" class="main_items_pic" alt="test image" /></a>'."\n";
echo "<font color=\"white\"></br><u>Product Description</u><br><br>$productDescription<br><br>£$sellPrice<hr color='gray' width='35%'></hr><br></font>";

 

Now when I click the image of say Product3 which has the productCode F00001, it takes me to product-catalogue.php?productCode=F00001, but this page looks exactly the same as the product-catalogue.php page. How do I edit the product-catalogue.php?productCode=F00001 page to only show that one item, rather than showing the whole catalogue?

 

Please explain in the dumbest way possible lol

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.