Page 1 of 1

how to pass/forward a URL?

Posted: Tue Jun 16, 2009 7:49 am
by sican
Hi there,
I have a problem with php, I've been looking around but I haven't found what I'm searching for..

The idea:
Now I have a user clicking on a link and directing him to a page where the wallpaper is. I want to change that and add more elements to that page, not only the image (like header, footer). And I though of doing it with PHP.
The link would lead to a wallpaper.php file and the image's URL requested would be displayed.

I have only gotten this far:

Code: Select all

<?php 
$file = 'http://www.website.com/something/image.jpg';?>
<img src="<?php echo $file ?>" alt="something" width="600px" height="434px" />
But how can I save the requested URL from a previous page and add/pass it to $file so that it displays the image I requested?
I don't know maybe there is an easier way to do this, if so I'm all ears! :)

Thanks in advance!

Re: how to pass/forward a URL?

Posted: Tue Jun 16, 2009 7:53 am
by mattpointblank
You could store the image info in a database, then pass it through the URL, eg, wallpaper.php?imageID=123 then on your php page, you can access the imageID from the URL by using $imageID = $_GET['imageID'] which you can then use in a query (after sanitizing it) to get the relevant data.

Re: how to pass/forward a URL?

Posted: Tue Jun 16, 2009 8:12 am
by sican
thanks for the reply!
I was thinking of something simpler to implement, because I've already have the previous version, I just want to make it easier with some smart php calling.
But the passing is favorable, how can I pass through URL? Making HTTP request? :p

For example, check out this website: http://vladstudio.com/home/. When you click a link, it displays on the address bar www.something.com/?cheshire_kitten which loads the image chesire_kitten

I think it does an http request, right? :roll: