Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.