php多页输入值会话变量打印
请在这里纠正我 我已经创建了多页表单,在这里我希望将数据从每个页面传递到最终页面,然后通过电子邮件提交这些数据。第一个是apply.php,有很多输入字段,但我已经列出了其中的一些,当一些人在passport字段中输入passport号码时,我希望在表单的每一页都传递这个信息,并在每页的几个地方打印出来。这里是传递这些字段时遇到的一些问题 这是第一页(apply.php)php多页输入值会话变量打印,php,forms,session-variables,Php,Forms,Session Variables,请在这里纠正我 我已经创建了多页表单,在这里我希望将数据从每个页面传递到最终页面,然后通过电子邮件提交这些数据。第一个是apply.php,有很多输入字段,但我已经列出了其中的一些,当一些人在passport字段中输入passport号码时,我希望在表单的每一页都传递这个信息,并在每页的几个地方打印出来。这里是传递这些字段时遇到的一些问题 这是第一页(apply.php) 这是apply2.php。这里有一些问题,我无法找到,正如您在下面看到的代码,我可以打印出生日期,但无法打印护照号(从表
这是apply2.php。这里有一些问题,我无法找到,正如您在下面看到的代码,我可以打印出生日期,但无法打印护照号(从表格1输入)。请纠正我的错误
<?php
session_start();
$msg="";
////include("connect.php");
if (isset($_POST['button1']))
{
extract($_POST);
$code=strtolower($_POST['captcha_code']);
$sess=strtolower($_SESSION["code"]);
if ($sess==$code)
{
$appid=time().rand();
$result=mysqli_query($con,"select *from registration where email='$email'");
if (mysqli_fetch_row($result)>0)
{
?>
<script>
alert("This email is already exist");
</script>
<?php
}
else
{
$query="insert into registration values('$appid','$passportno','$birthdate','$email')";
if (mysqli_query($con,$query))
$msg="Data saved Successfully.Please note down the Temporary Application ID $appid";
else
echo "not inserted".mysqli_error($con);
if (!isset($_SESSION["appid"]))
{
$_SESSION["appid"]=$appid;
}
}
}
else
{
?>
<?php
}
}
?>
<form name="OnlineForm" method="post" onsubmit="return OnSubmitForm();" action="apply3.php">
<input name="applid" id="applid" value="<?php echo $_SESSION["appid"];?>">
<input type="hidden" name="birthdate" value="<?php echo $birthdate;?>"><b><?php echo $birthdate;?>
<input name="passportno" type="text" class="textBoxDashed" id="passportno" value="" size="43" maxlength="14" value="<?php echo $passportno;?>">
input name="sc" type="submit" class="btn btn-primary" id="continue" value="Save and Continue" onclick="document.pressed=this.name">
不要使用提取。还要检查数据是否已设置。至于不获取数据,请尝试$\u POST['passportno']
,如果您想提取值并将其放回输入框,只需使用
在未定义的情况下不返回任何内容
此外,您还需要为您的输入添加一些保护。
您可以使用$passportno=mysqli\u real\u escape\u字符串($con,$passportno)添加保护代码>
<?php
session_start();
$msg="";
////include("connect.php");
if (isset($_POST['button1']))
{
extract($_POST);
$code=strtolower($_POST['captcha_code']);
$sess=strtolower($_SESSION["code"]);
if ($sess==$code)
{
$appid=time().rand();
$result=mysqli_query($con,"select *from registration where email='$email'");
if (mysqli_fetch_row($result)>0)
{
?>
<script>
alert("This email is already exist");
</script>
<?php
}
else
{
$query="insert into registration values('$appid','$passportno','$birthdate','$email')";
if (mysqli_query($con,$query))
$msg="Data saved Successfully.Please note down the Temporary Application ID $appid";
else
echo "not inserted".mysqli_error($con);
if (!isset($_SESSION["appid"]))
{
$_SESSION["appid"]=$appid;
}
}
}
else
{
?>
<?php
}
}
?>
<form name="OnlineForm" method="post" onsubmit="return OnSubmitForm();" action="apply3.php">
<input name="applid" id="applid" value="<?php echo $_SESSION["appid"];?>">
<input type="hidden" name="birthdate" value="<?php echo $birthdate;?>"><b><?php echo $birthdate;?>
<input name="passportno" type="text" class="textBoxDashed" id="passportno" value="" size="43" maxlength="14" value="<?php echo $passportno;?>">
input name="sc" type="submit" class="btn btn-primary" id="continue" value="Save and Continue" onclick="document.pressed=this.name">