Php Script error?

software development

#1

I wrote a simple php script and upload to “public html”,but it fail
to run.
It should redirect www.yahoo.com
to When Visiting http://www.mydomain.com/jump.php?id=2

The source of php script is here:

<?PHP if ($id == "1") {$link = "http://www.aluriasoftware.com/";} if ($id == "2") {$link = "http://www.yahoo.com/";} if ($id == "3") {$link = "http://www.3.com/";} if ($id == "4") {$link = "http://www.4.com";} if ($id == "5") {$link = "http://www.5.com/";} if ($id == "6") {$link = "http://www.6.net/";} if ($id == "7") {$link = "http://www.7.com/";} if ($id == "8") {$link = "http://www.8.com/";} if ($id == "9") {$link = "http://www.9.com/";} if ($id == "10") {$link = "http://www.10.com/";} if ($id == "11") {$link = "http://www.11.com/";} header("Location: $link"); exit(); ?>

BTW:This script works well in another web hosting server,but failed in DH.


#2

Instead of:
if ($id == “2”) {$link
= “http://www.yahoo.com/”;}

Try this:
if ($_GET[‘id’] == “2”) {$link
= ‘http://www.yahoo.com/’;}
Silk

My website


#3

Is it better to add this code before the if-else?

if (!isset($_GET[“id”])) $id=“0”;
else $id = trim(htmlspecialchars($_GET[“id”]));

:wink:

More code here Save [color=#CC0000]$97[/color] (max discount) with [color=#CC0000]97CRAZY[/color] SignUp NOW