Php 如何在下一页中显示插入数据
我有两张表格。在第二页中,手机号码未显示Php 如何在下一页中显示插入数据,php,jquery,html,mysql,Php,Jquery,Html,Mysql,我有两张表格。在第二页中,手机号码未显示 echo$_r['mobile']没有显示任何内容 我添加每个页面: <?php session_start();?> <?php include('include/config.php');?> 第二种形式/页面:sign2.php <form class="ff" action="sign2c.php" method="POST"> <a class="ase" >Enter Your Mobile
echo$_r['mobile']第二种形式的代码>没有显示任何内容
我添加每个页面:
<?php session_start();?>
<?php include('include/config.php');?>
第二种形式/页面:sign2.php
<form class="ff" action="sign2c.php" method="POST">
<a class="ase" >Enter Your Mobile No.</a>
<?php
$cid=$_SESSION['cid'];
$_q=mysqli_query($connection, "select * from mobile_message where mobile='$cid'");
$_r=mysqli_fetch_array($_q);
echo $_r['mobile'];
?>
</br></br>
<a class="ase" >Enter Password</a>
<input type="text" id="inp" name="otp" required>
</br>
<input type="submit" id="btn" value="continue">
</form>
输入您的手机号码。
更改行$cid=$\u POST['mobile']代码>而不是$cid=$sql['mobile']
insignc.php
$sql = mysqli_query($connection, "INSERT INTO `mobile_message` SET `mobile` = '$mobile'");
if($sql){
$cid=$_POST['mobile']; # write instead $cid=$sql['mobile'];
$_SESSION['cid']=$cid;
$_SESSION['s']= "OTP sent to your mobile.";
header('Location:sign2.php');
} else{
$_SESSION['e']= "Could not able to execute. ";
header('Location:sign.php');
}
尝试使用查询“echo$cid”。它有效吗?我尝试了“echo$cid”,但没有结果。
<form class="ff" action="sign2c.php" method="POST">
<a class="ase" >Enter Your Mobile No.</a>
<?php
$cid=$_SESSION['cid'];
$_q=mysqli_query($connection, "select * from mobile_message where mobile='$cid'");
$_r=mysqli_fetch_array($_q);
echo $_r['mobile'];
?>
</br></br>
<a class="ase" >Enter Password</a>
<input type="text" id="inp" name="otp" required>
</br>
<input type="submit" id="btn" value="continue">
</form>
$sql = mysqli_query($connection, "INSERT INTO `mobile_message` SET `mobile` = '$mobile'");
if($sql){
$cid=$_POST['mobile']; # write instead $cid=$sql['mobile'];
$_SESSION['cid']=$cid;
$_SESSION['s']= "OTP sent to your mobile.";
header('Location:sign2.php');
} else{
$_SESSION['e']= "Could not able to execute. ";
header('Location:sign.php');
}