您好,我的功能有一个简单的问题,有 2 个代码:
当我输入正确的答案时我需要 echo $row['answer']; 并在下一个代码中成功。
这意味着我需要当 $_POST['answer'] = $row['answer']; 回显我的密码
如果条件允许,有人可以帮我吗?
这段代码运行完美:
<?php
$username = $_POST['username'];
include('config.php');
$result = mysqli_query($con,"SELECT * FROM persons WHERE username='$username'");
while($row = mysqli_fetch_array($result)){
echo $row['username'];
echo "</br>";
echo "</br>";
echo "<p><b>Secret Question</b></p>";
echo $row['secret'];
$freeanswer = $row['answer'];
}
?>
同一页面中的代码问题:
</br>
</br>
<form action="" method="POST">
<p><b>Answer is :</b><p>
<input type="text" name="answer">
</br>
</br>
<input type="Submit" value="Submit">
</form>
</div>
<?php
$anme = $_POST['answer'];
if ($anme==$freeanswer) {
echo "sucess";
} else {
echo "wrong";
}
?>