Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Web Coding › PHP, javascript help please :) re: variables
New Posts  All Forums:Forum Nav:

PHP, javascript help please :) re: variables

post #1 of 3
Thread Starter 
Hi all,

So here is my problem,

I have a website that has a ton of different pages for galleries. I have used a javascript gallery that uses html to create the gallery and used some php to make it load the images automatically create thumbnails etc thats all fine.

What I want to do is streamline this now and have one gallery.php page and just set the title, intro paragraph and which folder to find the images in using php.

so im on the homepage i have a linkbar and on the linkbar is a hyperlink with the link to cakes.php

what I WANT is for all of the links to point to gallery.php AND send a variable at the same time so that when the page loads the gallery it loads the set of images I want.

so
Quote:
link 1 - a href="gallery.php">christmas cakes /a> also set $images=christmascakes>
link 2 - a href="gallery.php">anniversary cakes /a> also set $images=anniversary cakes>
so link 1 loads the gallery but gets images from the christmas cakes images folder and link2 loads the same gallery page but loads the images from anniversary cakes folder.

Probably an easier way to do this than php im all ears to all suggestions. Still learning so bear with me smile.gif

Thank you in advance to any help!

Regards,
Jake
Edited by anadalite - 8/14/12 at 7:11am
    
CPUMotherboardGraphicsRAM
i3 550 MSI P55-GD80 zotac 280 gtx amp edition 4gb crucial 1600 
Hard DriveOptical DriveOSMonitor
2x250gb raid 0 + 500gb WD caviar, 500gb wd blue Optiarc dvd ram windows 7 pro 23" Digimate 1080p 
KeyboardPowerCaseMouse
compaq stealthxstream 600w Antec nine hundred (dropped from desk :s) g500 
Mouse Pad
belkin gel pad 
  hide details  
Reply
    
CPUMotherboardGraphicsRAM
i3 550 MSI P55-GD80 zotac 280 gtx amp edition 4gb crucial 1600 
Hard DriveOptical DriveOSMonitor
2x250gb raid 0 + 500gb WD caviar, 500gb wd blue Optiarc dvd ram windows 7 pro 23" Digimate 1080p 
KeyboardPowerCaseMouse
compaq stealthxstream 600w Antec nine hundred (dropped from desk :s) g500 
Mouse Pad
belkin gel pad 
  hide details  
Reply
post #2 of 3
Look up $_GET and $_POST in the PHP manual. I would suggest the use of $_GET in this situation.
Edited by ARandomOWL - 8/14/12 at 3:52pm
Daily
(16 items)
 
  
CPUMotherboardGraphicsRAM
i7 2600K @ 4.8GHz, 1.4V Maximus IV Extreme GTX 560 DCII TOP 4x4GB Kingston HyperX 1866MHz CL11 
Hard DriveHard DriveCoolingCooling
Kingston HyperX 3K 120GB Samsung 640GB Thermochill PA120.2 Jingway DB-1 Pump 
CoolingCoolingOSMonitor
2x Kaze Jyuni 1900RPM EK Supreme HF Copper plexi Arch Linux x64 Acer X223HQ 1920x1080 
KeyboardPowerCaseMouse
Microsoft Sidewinder X4 Corsair HX750 Modded Corsair Carbide 500R Logitech M500 
  hide details  
Reply
Daily
(16 items)
 
  
CPUMotherboardGraphicsRAM
i7 2600K @ 4.8GHz, 1.4V Maximus IV Extreme GTX 560 DCII TOP 4x4GB Kingston HyperX 1866MHz CL11 
Hard DriveHard DriveCoolingCooling
Kingston HyperX 3K 120GB Samsung 640GB Thermochill PA120.2 Jingway DB-1 Pump 
CoolingCoolingOSMonitor
2x Kaze Jyuni 1900RPM EK Supreme HF Copper plexi Arch Linux x64 Acer X223HQ 1920x1080 
KeyboardPowerCaseMouse
Microsoft Sidewinder X4 Corsair HX750 Modded Corsair Carbide 500R Logitech M500 
  hide details  
Reply
post #3 of 3
Quote:
Originally Posted by ARandomOWL View Post

Look up $_GET and $_POST in the PHP manual. I would suggest the use of $_GET in this situation.

Good advice here.

What you're trying to do is really simple anyway, you're on the right road. I suggest the use of GET since you're not forwarding sensible data.
This said, the links on the linkbar must be like this:
Code:
<a href="gallery.php?images=xmascakes">xmas cakes</a>
<a href="gallery.php?images=anniversarycakes">anniversarycakes</a>

This will forward each time a different value through images, depending on the clicked link.

After this, on gallery.php, you need to retrieve this value. It can be done with the following code:
Code:
$images = $_GET['images'];

And that's it, $images will hold xmascakes or anniversarycakes.
Reply here if you need any further help! thumb.gif
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Web Coding
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Web Coding › PHP, javascript help please :) re: variables