Indefinite variable PHP_SELF

0

I'm doing a small example to identify when a page is reloaded for the second time, use php v5.7.14

PHP:

<?php

if ($_SERVER['REQUEST_METHOD'] == 'POST') 
{
    echo "primera vez";
}
else
{
    echo "mas de primera";
}?>

HTML:

<html>
<head>
    <meta charset="UTF-8">
    <title>ReCaptcha Demo</title>
</head>
<body>

    <form class="register" action="<?php echo $PHP_SELF;?>" method="post">
        <input type="text" name="Nombre" required="required" />
    </form>

</body>

Throw the following ERROR:

    
asked by Fede Lorca 07.04.2017 в 17:51
source

1 answer

2

The variable is misspelled should be something like this:

<form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" >
    
answered by 07.04.2017 в 17:59