Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

display a specific image depending on variable value

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

display a specific image depending on variable value

Postby juansoul » Fri Nov 01, 2002 10:53 am

I need help with the following:

I have a page with six diferent thumbnails, when a thumbnail is clicked another page comes up that displays the image that was clicked on, I know this can be done with plain html but then i would have to create one page per each thumbnail , I want to just build one page and the image displayed on this page will depend on which image was cselected on the proir page.

Now I will pass the values to the second page by appending the variable value on th url of the selected thumbnail,, please help

basicly i want to able to display a specific image depending on a variable's value
juansoul
New php-forum User
New php-forum User
 
Posts: 29
Joined: Tue Oct 08, 2002 6:33 pm

Does this help?

Postby Pinex » Fri Nov 01, 2002 12:51 pm

Yesterday I was locking for some functions to display images...
Found this at webmonkeys:

http://hotwired.lycos.com/webmonkey/01/ ... rogramming

Does it help?
Good luck!
;]-
User avatar
Pinex
New php-forum User
New php-forum User
 
Posts: 23
Joined: Tue Oct 29, 2002 5:06 am
Location: Norway & TheWWW

Postby Jay » Fri Nov 01, 2002 1:57 pm

Easily done and is the basics of server side programming.

Your link for picture a will be href="thepage.php?pic=a". When a user clicks on that link, they will be taken to thepage.php! That page will have a $_GET['pic'] variable with the value a. Of course, the value can change, which is why it's called a variable, but you use this to generate a page depending on what the person has selected!
Jay
 

Postby juansoul » Sat Nov 02, 2002 10:31 am

Thanx but how do I display the Image pn the second page what is the function for displaying an image ,I understand how to send the variable value on the link but how do I atache the variable value to the image
juansoul
New php-forum User
New php-forum User
 
Posts: 29
Joined: Tue Oct 08, 2002 6:33 pm

Postby Jay » Sat Nov 02, 2002 10:46 am

You just output normal HTML to display the image, but you construct the HTML in PHP
Jay
 

Postby juansoul » Sat Nov 02, 2002 11:07 am

I really apreciate It Jay but could you please show me wht the code on the page that display the image look like , I know you told me to use regular html to display the image so i guess the img src= shold be the value of hte variable dont understand that good could you please show me what the entire code to display the image depending on what you clicked on looks like
juansoul
New php-forum User
New php-forum User
 
Posts: 29
Joined: Tue Oct 08, 2002 6:33 pm

Postby Jay » Sat Nov 02, 2002 11:18 am

Suppose a person click on the image that said one, and you passed this over (?pic=one)

On your second page you could output something like
print "<img src='".$_GET['pic'].".jpg>\n";

or something like that. It really depends on how the variable links to the picture, and what else you want to output with it. I appreciate what you're asking is simple enough, but you've provided little information so all I can give you is a general rule, rather than one specific for your needs.
Jay
 


Return to PHP coding => General

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Yahoo [Bot] and 4 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron