When click on link it $_POST image, link and title to PHP file!
So here is the basic HT开发者_StackOverflowML I'm using:
<body>
<li>
<img src="Chrome.jpg"/>
<a title="Chrome" href="the.php">Visit Site</a>
</li>
<li>
<img src="IE.jpg"/>
<a title="internet explorer" href="the.php">Visit Site</a>
</li>
<li>
<img src="Mozilla.jpg"/>
<a title="Mozilla" href="the.php">Visit Site</a>
</li>
</body>
The PHP is still a mystery since I don't have the slightest clue on how to start it.
<?php
if($_POST = "Mozilla"){
$someValue = "http://Mozilla.com";
$someValue = "Mozilla.jpg";
$someValue = "Mozilla";
}
?>
And here is the page that will direct the user to the desired destination, it will have
the image, the title, and the link:<html>
<head>
<meta http-equiv="refresh" content="10;url=<?php echo $someValue;?>">
</head>
<body>
<img src="<?php echo $someValue;?>" />
Please Wait While we direct you to <?php echo $someValue;?>
</body>
</html>
It looks confusing but I hope you get the point of what I'm trying to do.
There's not need of $_POST
variables. Post is mostly used for form submits. Despite the fact that you could simulate it, it is not very recommended. Instead of using the POST method I'd suggest you to use the GET method via query string: www.google.com?variable=value
retrieving variables using $_GET['variable']; // = value
.
This is the main page.
<body>
<li>
<img src="Chrome.jpg"/>
<a title="Chrome" href="the.php?browser=chrome">Visit Site</a>
</li>
<li>
<img src="IE.jpg"/>
<a title="internet explorer" href="the.php?browser=ie">Visit Site</a>
</li>
<li>
<img src="Mozilla.jpg"/>
<a title="Mozilla" href="the.php?browser=mozilla">Visit Site</a>
</li>
</body>
This is the.php
:
<?Php
$default_browser = 'chrome'; // change it as you want
$browser = (isset($_GET['browser'])) ? $_GET['browser'] : $default_browser;
switch ($browser) {
case 'chrome':
$link = // link
$image = // image
$title = // title
break;
case 'ie':
$link = // link
$image = // image
$title = // title
break;
case 'mozilla':
$link = // link
$image = // image
$title = // title
break;
}
?>
<html>
<head>
<meta http-equiv="refresh" content="10;url=<?php echo $link;?>">
</head>
<body>
<img src="<?php echo $image;?>" />
Please Wait While we direct you to <?php echo $title;?>
</body>
</html>
You have to fill $link
, $image
and $title
with what you want.
Tell me if something is confusing.
精彩评论