Error with <?php print $_SERVER['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
mariolopes
Forum Contributor
Posts: 102
Joined: Sun May 22, 2005 7:08 am

Error with <?php print $_SERVER['PHP_SELF']?>

Post by mariolopes »

Hi
Why i get error with the following code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Um formulário HTML que se chama a si próprio</title>
</head>
<body>
<div>
<?php
if ( ! empty( $_POST['convidado'] ) ) {
print "Último convidado: ".$_POST['convidado'];
}
?>
<form method="post" action="<?php print $_SERVER['PHP_SELF']?>">
<p>
Escreva aqui o seu nome: <input type="text" name="convidado" />
</p>
<p><input type="submit" value="Executar!" /></p>
</form>
</div>
</body>
</html>
I get Forbidden access - don't have permissions and in my web address i get
http://localhost/vendasphp/%3C?php $_SERVER['PHP_SELF']?>
Any help, please?
Thank you
User avatar
Ragnis
Forum Commoner
Posts: 31
Joined: Thu Nov 13, 2008 12:35 pm
Location: Saaremaa, Estonia, Europe, Asia, Planet Earth, The Solar System, Milky way.

Re: Error with <?php print $_SERVER['PHP_SELF']?>

Post by Ragnis »

Have you saved your file with .php extension?
mariolopes
Forum Contributor
Posts: 102
Joined: Sun May 22, 2005 7:08 am

Re: Error with <?php print $_SERVER['PHP_SELF']?>

Post by mariolopes »

Uppps....
Thank you my friend solved my problem
Post Reply