Forum Moderators: coopster

Message Too Old, No Replies

passing mutliple variables

using variables to build a gallery on included pages

         

shudson250

6:22 am on Jun 22, 2007 (gmt 0)

10+ Year Member



Im building a website using just the index.php and includes for the different pages. When someone clicks the link, it will send itself index.php?content=gallery.php so it changes the content. My problem comes when the gallery comes into play. Here is the code:
<?php
if(isset($picture) && $content=='gallery.php'){

echo "<img src='gallery/".$pic."'/>";
}else{
echo "Please select a picture to view on the far right";
}

?></div>
<div id="galleryNavTable" class="bodytype">
<table align="center" width="80%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<th scope="col"><span class="style1">Select an Image</span></th>
</tr>
<?php
//The source Directory of the images
$d = dir("gallery/");
while($pic=$d->read()) {
//the numbering beside the row of links
$i=$i+1;
if(($pic <> '.') AND ($pic <> '..')){
?>
<tr>

This is where my trouble comes. How do I send the variable to the proper part in the a href tag?

<td align="center"><a href="index.php?content=gallery&picture=<?php print "$pic";?> " target="_self"><?php echo $i?> </a></td>
</tr>
<tr><td>&nbsp;</td>
</tr>
<?php
}
}
$d->close();
?>

Any help on this would be greatly appreciated!

shudson250

6:33 am on Jun 22, 2007 (gmt 0)

10+ Year Member



haha, its always the spelling errors that are the best!

in my a href tag, i needed the '.php' after gallery. Ain't that the way it is...

jatar_k

12:38 pm on Jun 22, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



>> Ain't that the way it is...

hehe, always

good catch