<分区>
<分区>
我想在提交第一个输入的值后更改第二个输入的值,但它没有发生。我想在第二个输入值中打印电子邮件
<?php
$db = mysqli_connect('localhost','root','root','rahul');
if(isset($_POST['submit']))
{
$email = $_POST['email'];
$sql = mysqli_query($db,"select * from register where email='$email'");
if(mysqli_fetch_array($sql)==true)
{
echo '<input type="text" name="question" value="$email">'; /* 2nd input */
}
else
{
echo "no";
}
}
?>
<center><br><br>
<form action="" method="post" >
<input type="text" name="email"><br><br> /* first input*/
<input type="submit" name="submit">
</form>
最佳答案
echo '<input type="text" name="question" value="$email">';
: 这是行不通的,因为你必须使用双引号来回显其中的 php var
像这样:
echo "<input type='text' name='question' value='$email'>";
或者像这样:
echo "<input type='text' name='question' value='".$email."'>";
关于php - 无法在 php 代码中打印 php 变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36290214/