Page 1 of 1

multiple variables in href

Posted: Tue Oct 09, 2007 7:57 pm
by louislibert
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I'm a PHP beginner. What I'm trying to do is have a page with thumbnails along the bottom. Every time you hit a thumb the large image above the thumbs changes and the caption under the picture changes as well. I've got it where the picture changes just fine but I can't figure out how to change the caption.

The code for the picture is:

Code: Select all

<?
	$title = 'paris_color';
	if ($_GET['b']){ print '<img class="images" src="galleries/paris_color/full/' . $title . $_GET['b'] . '.jpg" height="425">';
	} else { print '<img class="images" src="galleries/paris_color/full/' . $title . '1.jpg" height="425">'; }	 
?>

The corresponding code on one of the thumbs is:

<a href="<?= $title ?>_gallery.php?b=2 $caption = 'this is the first image'"><img class="thumb" src="galleries/paris_color/thumbs/paris_color2.jpg" width="50" height="50" /></a>

So far I've got this for the caption code:

Code: Select all

<?
	$caption = 'this is the first image';
	print "$caption"; 
?>
My questions are:

1. How do I append the a tag to make it change the caption also?

2. Does the caption code I'm using have to be augmented as well?

I know this must be a really basic problem but I haven't been able to find anything in my books or online that specifically addresses it.

Thanks to anyone who's able to help me.

Louis Libert


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Tue Oct 09, 2007 8:55 pm
by phpdevuk
well your link with caption is wrong

Code: Select all

<a href="<?= $title ?>_gallery.php?b=2&caption=this is the first image"><img class="thumb" src="galleries/paris_color/thumbs/paris_color2.jpg" width="50" height="50" /></a>
I altered the caption variable in the url there so it would get sent on click, and you need to use a similar method to your $_GET check on images for caption.