So,
basically I have this image gallery > http://sensemillia.com/#/pages/necklaces.php
once the user clicks on one of them images he’s lead to the item.php > http://sensemillia.com/#/pages/item.php
As you can see on the left side of the box, there is an image and on the right, there’s text.
What I’d like to do, is tell to dynamically item.php load the content depending the url.
Moreover, if the user for example clicks on the first image in the gallery, the url should look like this > …item.php?id=01 and then accordingly the content of the box should load image01.jpg on the left column, and div01 on the right.
I’ve searched a lot for this, but all I find are complicated asp or .net answers.
Is there a simple way?
Thank you very much in advance. Any help would be greatly appreciated.
ANSWER
<?php $actual_link = "$_SERVER[REQUEST_URI]";
if ($actual_link == "/pages/item.php?id=11") {
print ("<img src='../Sensemillia/sousou.jpg' id='jack' width='392'
height='475' alt='Daisy on the Ohoopee'/>");
}
else if ($actual_link == '/pages/item.php?id=12') {
print ("<img src='../Sensemillia/second.jpg' id='jack' width='392'
height='475' alt='Daisy on the Ohoopee'/>");
}
?>
You can use session variables or use POST to send data between the pages and fetch the data from your database
How do I pass data between pages in PHP?
PHP Pass variable to next page
Edit:
Maybe you’ll want to start here:
http://www.homeandlearn.co.uk/php/php.html
It will give you basic understanding of php and allow you implement that feature on your site.
Also when you’re comfortable with mysql queries you’ll want to replace them with PDO