提交前查看联系表

时间:2019-10-05 22:25:39

标签: javascript php mysql forms input

需要帮助...我希望人们在单独的页面上检查其表单输入,然后从第二页确认其提交,我该怎么做?

//索引页

<form action="confirm.php" method="post">
<input type="text" name="uname">
    <input type="submit" value="next">

</form>

<?php

$name = $_POST["uname"];


echo('


<form action="submit.php" action="post">

// trying to prefill the form so that on submit the values are sent to submit.php
<input  value=$name name="username"> // setting the value to be captured in the next form = php variable $name


<input type="submit" value="next">

</form>
'


)

?>

1 个答案:

答案 0 :(得分:1)

您将需要在会话中保留预览数据。这只是基于您的请求的示例。

<form action="" method="post">
<input type="text" name="uname">
    <input type="submit" value="next">

</form>

<?php
error_reporting(0);
session_start();
$name='';
$uname='';

$name = $_POST["uname"];
echo $_SESSION['uname'] = $name; 


if($_SESSION['uname'] !=''){

?>


<form action="submit.php" action="post">
<input type="text" value="<?php echo $_SESSION['uname']; ?>" name="username">
<input type="submit" value="next">

</form>

<?php
}
?>