guys! Im new in PHP and im developing a small website wherein there's many images on the page and when i click one of the image it must be shown into another page with full details.. but the problem when i click one of the image it shown's nothing! I tried to use $_SESSION[]; but I can't get the logic how to properly use it.. thnx.. please help..

Show some code, we need to know how you're trying to approach the problem. We need more details.

<?php 
//this is from image clicked from the previous page..
$_SESSION['image']=$_POST['image'];

echo $_SESSION['image']; 



?>

<img  src="images2/<?php echo $_SESSION['image'] ?>.jpg" width="300" height="250">    

if you already have the info you need in $_POST there is no reson to put it in a $_SESSION.
$_POST is usaly obtaind from a <FORM> on the first page or by an AJAX-request.
if you just want to send the image name to the 2 page why not use $_GET
on page 1

echo"<a href='page2.php?imageName=$imageName'>...</a>";

on page 2

$imageName=$_GET['imageName'];

'pzuurveen' message is perfect

"pzuurveen"

yeah.. thnx its running well but it shows nothing, i think there's something wrong with my code.. please check:

Page1.php:

    $query = "SELECT * FROM cfashion_mens";

    $result = mysql_query($query) or die(mysql_error());

        while($row = mysql_fetch_array($result)){
            $image = $row["image"];
            $img_name = $row["img_name"];
            $price = $row["price"];

            ?>
            <?php 
            echo'<table>';
            echo '<tr><td>';?>
            <img   style = "width:250px; height:250px;" title=" <?php echo $img_name ?>" src = "<?php echo $image; ?> "  /><?php echo '</td></tr>';?>


              **  //I try to use your code here:***
                //echo"<a href='page2.php?image=$image'>...</a>";**


            <?php

            echo '<tr><td align="center">' . $img_name . ' == £' .  $price . '</td></tr>' ;

            echo '</table>';
        }

Page2.php

$imageName=$_GET['image'];

Page1.php is running well but when i click one of the images in the page.. then it shows nothing into page2.php..

Did you echo $imageName=$_GET['image']; on page2.php ?

please show your page2 codes ...

"Bachov Varghese"

im done with that problem "Bachov Varghese" I change my code into this:

"page1.php"

    /* selected table*/
    $query = "SELECT * FROM cfashion_mens";

    $result = mysql_query($query) or die(mysql_error());

        while($row = mysql_fetch_array($result)){
            $image = $row["image"];
            $img_name = $row["img_name"];
            $price = $row["price"];

    <a href="SalesPage2.php?ref=<?php echo $image; ?>">

<?php
        ?><img src = "<?php echo $image; ?> "/>;
<?php
        echo $img_name .  $price ;
}       
        echo '</table>';
?>

"page2.php"

    <img src = "<?php echo $_GET['ref'] ?>"  />;

my problem now is... I want to get all the details of each image from page1.php down here to page2.php.. but suddenly only image is shown.. please help.. thnx

$image = $row["image"]; is $row["image"] the url to the image?

after that you start messing up php and html code

$row["image"] is a row from my database.. also $row["img_name"] and $row["price"].. I actually done sending the image from page1.php to page2.php but the other details like price and img_name.. dsn't shown on page2.php what's the best thing to do?..

I want to show single image from one page to another page in php. In first i have multiple picture from database using path. But i want to show one image on another page when user click on particular image from page one. When user click on first page image it will automatically move to second page and display that image.

Member Avatar for diafol

Start your own thread as this may be a slightly different take on the OP.

commented: It smells like a spammy post to me :) +6

Hi i would like ask if i want to make the opposite ... The thing is if i want to make the image take from the html page?.... Like and exsample that iam make page by using html ..cool .. Then iam done from make connection my html page with mysql ... Usually people use the link the image they wany from the desktop .. Or any imge from the coputer ... But i want when i cklick the image from the web page directly this image send to my database ... Can any one help me on that

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.