Skip to content Skip to sidebar Skip to footer

Why Is That My Modal Isn't Working Through Html Form?

Why is that my Modal is not working? Is it wrong to use POST method? When I load the page and click the link for forgot password and the modal is eventually is display then when I

Solution 1:

Firstly, you don't have a submit with the "submit" name attribute to go with $_POST['submit'] and that's the reason why it's failing, so nothing in there if(isset($_POST['submit'])){...} will get executed.

So do this:

<button type="submit" class="getPasswordButton" name="submit">Send</button>

or an input:

<input type="submit" class="getPasswordButton" name="submit" value="Send">

Plus, MYSQL_ASSOC needs to be MYSQLI_ASSOC. You can't mix MySQL functions.

However, looking at if(mysqli_num_rows($sql2) < 1){ that may need to be changed using > operator. Doing < 1 tells MySQL if it does not exist; an insight.


Solution 2:

Your form must have an action attribute. Its value must be the name of the script file that handle the form.

<form action="your/php/script.php" method="post">

or, if the php script is on the same page with the form, you can write:

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">

Post a Comment for "Why Is That My Modal Isn't Working Through Html Form?"