New to PHP, need info

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
OsiViper
Forum Newbie
Posts: 5
Joined: Thu Jan 20, 2005 9:55 am

New to PHP, need info

Post by OsiViper »

ok, im new to php coding, im trying to figure out if there is a way to carry a variable from one page and have it show in the next.

For example, i have one page that is used just to display pictures, i use it as a popup window, and on the previous page i have a Gallery, is there any way to have a variable that carry's into the page its opening from the page that opened it, so i dont have to have a seperate page for each picture, so that i can just put something in so when it clicks on the link it opens the window and opens the picture i clicked on.
(If that makes any sense)

Thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you can pass information through the url of the popup script.. like

your_script.php?id=987123423478

then use $_GET to retrieve the passed information. In this example: $_GET['id'] would equal '987123423478'
OsiViper
Forum Newbie
Posts: 5
Joined: Thu Jan 20, 2005 9:55 am

Post by OsiViper »

now how would i get that to work with <img src="">
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

that depends on how you stored the image.. if it's inside the database, then you need to point it to a downloader type script; search for "+force +download"

if you stored the filename/path of the image, then you can use php to place that accessible path as the src url. If you want to keep the path to the file "secret", then use a downloader script as found by the above stuffs.
OsiViper
Forum Newbie
Posts: 5
Joined: Thu Jan 20, 2005 9:55 am

Post by OsiViper »

its as a file, i really dont care about keeping it a seceret
OsiViper
Forum Newbie
Posts: 5
Joined: Thu Jan 20, 2005 9:55 am

Post by OsiViper »

grr i cant figure it out lol. (I just started using PHP Yesterday)

Code: Select all

<?PHP 
echo "<img src="pictures"'.$_GET['id].'".jpg"' width="754" height="570">";
?>
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

since the actual filepath is stored in the database, you'll need to fetch it using the id passed.
Post Reply