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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bradsteele
Forum Newbie
Posts: 15
Joined: Fri Jun 17, 2005 10:27 am

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

Post 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>';
}
?>
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post 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
bradsteele
Forum Newbie
Posts: 15
Joined: Fri Jun 17, 2005 10:27 am

Post by bradsteele »

THANKS, worked like a charm, I'll look into that link you posted too.
Post Reply