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 input my email nothing happens. Could someone help me?
This is my PHP script.
<?php
require 'db.php';
$msg='';
if(isset($_POST['submit']))
{
$emailRet = mysqli_real_escape_string($connection, $_POST['emailRetrieve']);
$sql2 = mysqli_query($connection, "SELECT Email_Address, Password FROM pawnshop WHERE Email_Address='".$emailRet."'");
while ($row = mysqli_fetch_array($sql2, MYSQL_ASSOC)) {
$emailRetrieve = $row['Email_Address'];
$passwordRetrieve = $row['Password'];
}
$number = mysqli_num_rows($sql2);
echo $number;
if(mysqli_num_rows($sql2) < 1){
require 'smtp/Send_Mail.php';
$to = $emailRetrieve;
$subject = "PBMS Password Retrieval";
$body ='Hi, This is your account information<br><br> Username:'.$emailRetrieve.'<br> Password:'.$passwordRetrieve.'';
Send_Mail($to,$subject,$body);
$msg='Check your email to get your password';
echo 'send';
}
else
{
$msg='Check your email and try again';
}
}
?>
This is my html code for Modal
<html>
<head>
<link type='text/css' href='css/modal.css' rel='stylesheet' media='screen' />
<script type='text/javascript' src='js/jqueryModal.js'></script>
<script type='text/javascript' src='js/jquery.simplemodal.js'></script>
<script type='text/javascript' src='js/modal.js'></script>
</head>
<body>
<form method="post">
<div id='basic-modal'>
<center>
<a href='#' class='basic custom-font-reg'>Forgot password?</a><br>
<a href='Registration.php' class='custom-font-reg'>Register for an account?</a>
</center>
</div>
<hr class="hr-custom2">
<div id="basic-modal-content">
<div class="getPasswordWrapper">
<hr class="PasswordHeaderColor"></hr>
<p class="enterEmailPasswordText">Enter your username to get your password</p>
<center>
<input type="text" name="emailRetrieve" class="getPassword" placeholder="Your UsernameEmail" required/>
<button type="submit" class="getPasswordButton">Send</button>
<span><?php echo $msg; ?></span>
</center>
</div>
</div>
</form>
</body>
</html>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…