1.

Solve : Basic PHP error ; please help!?

Answer»


$user=$_POST['log'];
if (&user=='ha') ECHO 'window.location="page.php"';
else echo 'window.location="http://www.herbertsworld.com/"';
?>





It does nothing.Like before, you're GETTING mixed up with JAVASCRIPT and PHP.

Code: [Select]window.location="http://www.herbertsworld.com/";
....is JavaScript.

The PHP method of this is:
Code: [Select]header("Location: http://www.herbertsworld.com/");
The full PHP code for what you have above, is this:

Code: [Select]<html>
<HEAD></head>
<BODY>
<?php
$user = $_POST['log'];
if ($user=='ha') 
{ header("Location: /page.php"); }
else
{ header("Location: http://www.herbertsworld.com/"); }
?>
</body>
</html>
Quote from: Bannana97 on April 10, 2009, 11:44:52 AM
<html>
<head />
<body>
<?php
$user=$_POST['log'];
if (&user=='ha') echo 'window.location="page.php"';
else echo 'window.location="http://www.herbertsworld.com/"';
?>
</body>
</html>
It does nothing.

Code: [Select]if (&user=='ha')
ifs $user. Quote from: gh0std0g74 on April 10, 2009, 09:21:31 PM
Code: [Select]if (&user=='ha')
ifs $user.

What? Quote from: kpac on April 11, 2009, 03:27:31 AM
What?
&user should be $userAha, sorry about that......


Discussion

No Comment Found