Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing value from thumbnail page to PHP page

Status
Not open for further replies.

ljCharlie

IS-IT--Management
Joined
Apr 21, 2003
Messages
397
Location
US
Is there a way to send a value from a photo gallery web page to a PHP page? Here's my situation. I want to create a photo gallery that a user can click on the thumbnail image and then a PHP page with the enlarge photo will display. The PHP page that have the enlarged photo also have a Javascript that alows the user to click the Next/Previous and Automatic button to load the image without loading a .html file that contains the enlarged photo. However, here's the problem. I want the PHP page to first load the enlarged version of the image that was clicked on the thumbnail page. And to do this, I have to pass a value from the thumbnail page to the PHP page so I can determine which image was clicked and load the enlarged version of that image to the PHP page. So I guess the question is, how do I pass a value from thumbnail page to the PHP page?

Any help is greatly appreciated!

Thank you,

ljCharlie
 
Thank you very much for your help. Below is what I have in the thumbnail page.

<a href=&quot;photoEnlarged.php&quot;><img src=&quot;photos/lp0001.jpg&quot; width=&quot;100&quot; height=&quot;67&quot; border=&quot;0&quot;></a>

Is the below code along the line of what you're saying?

<a href=&quot;photoEnlarged.php&quot;><img src=&quot;photos/lp0001.jpg&quot; width=&quot;100&quot; height=&quot;67&quot; border=&quot;0&quot;>Photo1</a>

One more thing, all of my thumbnails have to be in a <Form></Form> correct?

ljCharlie
 
Here's what I have tried:

<a href=&quot;photoEnlarged.php?lpName=lp0001&quot;><img src=&quot;photos/lp0001.jpg&quot; width=&quot;100&quot; height=&quot;67&quot; border=&quot;0&quot;></a>

And in the PHP page:

$photoName = $HTTP_GET_VARS[&quot;lpName&quot;];

But it's not working. The link wasn't able to load the &quot;photoEnlarged.php&quot; page.

ljCharlie
 
Then try this:

$photoName = $_REQUEST[ignore][[/ignore]&quot;lpName&quot;[ignore]][/ignore];

Good luck §;O)


Jakob
 
Still not working. I'm thinking that maybe it could in this line:

<a href=&quot;photoEnlarged.php?lpName=lp0001&quot;><img src=&quot;photos/lp0001.jpg&quot; width=&quot;100&quot; height=&quot;67&quot; border=&quot;0&quot;></a>

The error is:
The page cannot be found

It looks like the link is not even calling the PHP page.

ljCharlie
 
Is the path to the script correct in your href attribute, relative to the path of the page on which it appears? Is this a PHP error or a browser error?

And I disagree with dkdude's recommendation that you access the value in your script via $_REQUEST. $_REQUEST contains the contents of $_GET, $_POST, and $_COOKIE, so using $_REQUEST can allow a mistake on your part or a malicious activity on a user's part to poison your input values and thus subvert your code. Reference $_POST, $_GET, and $_COOKIE instead.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
ljCharlie,

I just tried it and it works fine. Try replacing the question mark with an ampersand (&quot;and&quot;-sign) - both works for me...

Try echo'ing the imagename. BTW -did you remember to add the file extension?

Here's my test:
[tt]<?

$img = $_REQUEST[&quot;img&quot;];

echo &quot;IMG is $img<BR>&quot;;
echo &quot;<IMG SRC=\&quot;$img\&quot;>&quot;;

?>
[/tt]



Jakob
 
Thank you. I'll give that a try. I believed there is some other problems too. I tried just type in the name of the PHP file and the same error occurred. So I'm guessing it's not the code but perhaps my server isn't reading PHP files.

ljCharlie
 
Not supporting PHP!?

This simple script should display a large page of information on the PHP configuration. If it does not -then I guess that PHP is not supported on your server...

[tt]<?

phpinfo();

?>[/tt]


Good luck §;O)


Jakob
 
Thank you guys! It works wonderfully! I'm greatly appreciate both of your help.

ljCharlie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top