Enrique García
Enrique García

Reputation: 121

Why this submit action dont work with php isset?

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?

Upvotes: 1

Views: 124

Answers (3)

Rahul Gandhrokiya
Rahul Gandhrokiya

Reputation: 76

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

Upvotes: 2

Pazuzu
Pazuzu

Reputation: 63

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

Upvotes: 0

Ashwani
Ashwani

Reputation: 732

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

Upvotes: 0

Related Questions