PHP code using the $_GET function (need help!)
Posted: Sat Jul 25, 2009 12:57 am
So I'm creating a photography portfolio for my website, and I'm using PHP to have a more dynamic portfolio.
What I'm wanting is to be able to have a certain number of images, let's say 3, when users click portfolio, which for example, let's say goes to:
http://iaminstantdeath.com/test/index.php
When you get there, it currently only shows the links to page1 and page2. I want 3 images to be at the top, and then change when you click page1 and page2.
If you click page1 and page2 right now, it will do as I want it to, and the url will become:
http://iaminstantdeath.com/test/index.php?page=1
If you can help me get what I want, please help me out!
Here's the code I'm using:
What I'm wanting is to be able to have a certain number of images, let's say 3, when users click portfolio, which for example, let's say goes to:
http://iaminstantdeath.com/test/index.php
When you get there, it currently only shows the links to page1 and page2. I want 3 images to be at the top, and then change when you click page1 and page2.
If you click page1 and page2 right now, it will do as I want it to, and the url will become:
http://iaminstantdeath.com/test/index.php?page=1
If you can help me get what I want, please help me out!
Here's the code I'm using:
Code: Select all
<?php
$tmp = $_GET['page'];
if($tmp == "1"){
echo "<a href=\"http://iaminstantdeath.webs.com/portfolio/4.jpg\" rel=\"lightbox\" title=\"<br>© instant death photography\"><img src=\"http://iaminstantdeath.webs.com/portfolio/4.jpg\" height=\"150\" width=\"100\" border=\"0\" /></a> ";
echo "<a href=\"http://iaminstantdeath.webs.com/portfolio/5.jpg\" rel=\"lightbox\" title=\"<br>© instant death photography\"><img src=\"http://iaminstantdeath.webs.com/portfolio/5.jpg\" height=\"150\" width=\"100\" border=\"0\" /></a> ";
echo "<a href=\"http://iaminstantdeath.webs.com/portfolio/6.jpg\" rel=\"lightbox\" title=\"<br>© instant death photography\"><img src=\"http://iaminstantdeath.webs.com/portfolio/6.jpg\" height=\"150\" width=\"100\" border=\"0\" /></a> ";
}
$tmp = $_GET['page'];
if($tmp == "2"){
echo "<a href=\"http://iaminstantdeath.webs.com/portfolio/7.jpg\" rel=\"lightbox\" title=\"<br>© instant death photography\"><img src=\"http://iaminstantdeath.webs.com/portfolio/7.jpg\" height=\"150\" width=\"100\" border=\"0\" /></a> ";
echo "<a href=\"http://iaminstantdeath.webs.com/portfolio/8.jpg\" rel=\"lightbox\" title=\"<br>© instant death photography\"><img src=\"http://iaminstantdeath.webs.com/portfolio/8.jpg\" height=\"150\" width=\"100\" border=\"0\" /></a> ";
echo "<a href=\"http://iaminstantdeath.webs.com/portfolio/9.jpg\" rel=\"lightbox\" title=\"<br>© instant death photography\"><img src=\"http://iaminstantdeath.webs.com/portfolio/9.jpg\" height=\"150\" width=\"100\" border=\"0\" /></a> ";
}
?>
<head>
<script type="text/javascript" src="../prototype.js"></script>
<script type="text/javascript" src="../scriptaculous.js?load=effects"></script>
<script type="text/javascript" src="../lightbox.js"></script>
<link rel="stylesheet" href="../lightbox.css" type="text/css" media="screen" />
<body>
<?php echo "<br><table align=\"right\"><a href=\"index.php?page=1\">page1</a></table>";?>
<?php echo "<br><table align=\"right\"><a href=\"index.php?page=2\">page2</a></table>";?>