How would I create a page that changes its info depending on the button clicked?
What I have is 12 images that are coupons, and each one is meant for each month. I have it so the site will find out the date, and the image that has the name of what month it is, will be posted. I also have it so it shows the next 2 months' images.
So I have 3 images that will change each 开发者_如何学运维month, and what I would like it to do is when someone clicks one of the image, it brings you to an info page. I want the info page's content to change depending on what image they pick.
I am really stuck on how to do this and I would like some ideas on what would be the best way to do it?
Thanks! I am using PHP
<a href="info.php?month=1"><img src="your_image.jpg" /></a>
and in your info.php page
<?php
switch ($_GET["month"]) {
case '0':
echo "some content";
break;
case '1':
echo "some other content";
break;
}
?>
Make the images link to URLs like infoscript.php?couponid=123
and fetch the couponid
in PHP this way (in the infoscript.php
or whatever you name it):
$couponid = $_GET["couponid"];
settype($couponid, "integer");
This assumes that all couponids are numbers.
精彩评论