Page 1 of 1

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

Posted: Tue Jan 05, 2010 5:52 am
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

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

Posted: Tue Jan 05, 2010 6:14 am
by Ragnis
Have you saved your file with .php extension?

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

Posted: Tue Jan 05, 2010 6:17 am
by mariolopes
Uppps....
Thank you my friend solved my problem