Why this submit action dont work with php isset?

128 views Asked by At

I have this code, is an HTML register with an php action when you press submit button

<html>
<head>
    <title>Pruebas de registro </title>
</head>
<body>
    <h1 align="center"> FORMULARIO DE REGISTRO </h1>
<form align="center" method="POST">
<p>User: <input type="name" name="user"></input> </p>
<p>Pass: <input type="password" name="password"> </p>
<p>RPass: <input type="password" name="password2"> </p>

<input type="submit" name="submit" value="Ok"> </input>
<input type="reset" value="Reset"></input>

</form>
<?php
    If (isset($_POST['submit'])) {
        echo "Has presionado submit"
}
?>
</body>

</html>

Why when I press "OK" submit button the php doesn't say me "Has presionado submit" with the isset?

3

There are 3 answers

0
Rahul Gandhrokiya On BEST ANSWER

you have syntax error in If condition you forgot to wrote a ; after echo statement

0
Ashwani On
<?php
    if (isset($_POST['submit'])) {
        echo "Has presionado submit"; // ; is missing
}
0
Pazuzu On

Write if like this "if" not like this "If", and add a semicolon after your echo.