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&#8221;;
}
elseif($_POST[choice] == “yahoo”)
{
$selection = “http://www.yahoo.com&#8221;;
}
elseif($_POST[choice] == “bing”)
{
$selection = “http://www.bing.com&#8221;;
}

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.