Simple PHP Redirector

This code represents a simple PHP redirector for your web site :) .

php_redirector

php_redirector

PHP_Redirector.php


<?php

if($_POST[choice] == “google”)
{
$selection = “http://www.google.lk”;
}
elseif($_POST[choice] == “yahoo”)
{
$selection = “http://www.yahoo.com”;
}
elseif($_POST[choice] == “bing”)
{
$selection = “http://www.bing.com”;
}

header(“Location: $selection”);

?>

<html>
<head>
<title> Wich Search Engine </title>
</head>
<body>
<div style =”background:#339933″>
<form action = “<?php $_SERVER[PHP_SELF] ?>” method = “POST”>
&nbsp;<font color=”#99ff66″><b>Take me to:</b></font>
<input type = “radio” name = “choice” value = “google”>Google &nbsp;<b>|</b>
<input type = “radio” name = “choice” value = “yahoo”>Yahoo &nbsp;<b>|</b>
<input type = “radio” name = “choice” value = “bing”>Bing<br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;
<input type = “submit” value = “Take Me”>
</form>
</div

</body>
</html>

*******

You can also use a html table instead of using ‘<div></div>’ tags. It will be more easy for you to align its elements.

Advertisement

2 responses to this post.

  1. wow…this is great work buddy…. keep writing more useful stuff. Good Luck

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.