Page 1 of 1

What is wrong with this code? its an echo call on PHP_Self

Posted: Fri Jun 17, 2005 1:42 pm
by bradsteele
I am getting the following error when I try to run the code below:

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in c:\Inetpub\wwwroot\Login\log.php on line 23

I am new to PHP and am not sure of the syntax for this type of statement....can anyone point out what is wrong here? Do I need a special character in fron of the ' that surrounds the PHP_SELF?

Thanks,

Brad

Code: Select all

<?PHP

$user = $_POST["username"];
$pass = $_POST["password"];
$runner = $_POST["formRanOnce"];
echo "this is runner = $runner";
if ($runner == "") { 
echo '<form method = "POST" action="<?PHP echo $_SERVER['PHP_SELF']; ?>"> ';
echo '<input name="formRanOnce" type="hidden" value="TRUE">';
echo 'Username: <input name="username" type="text" maxlength="25" tabindex="1"> <br>';
echo 'Password: <input name="password" type="text" maxlength="25" tabindex="2">';
echo '<input name="Login" type="submit" value ="Login">';
echo '</form>';
}
?>

Posted: Fri Jun 17, 2005 1:46 pm
by John Cartwright

Code: Select all

echo '<form method = "POST" action="'.$_SERVER['PHP_SELF'].'"> ';
This explains everything you need to know about strings :0
http://ca3.php.net/types.string

Posted: Fri Jun 17, 2005 2:06 pm
by bradsteele
THANKS, worked like a charm, I'll look into that link you posted too.