简体   繁体   English

我如何在不将那些数据记录到数据库的情况下将第一种格式的数据传递给第二种格式?

[英]how can i pass the data of the first form to the second one without recording those data on the database yet?

I have 2 forms on my project and their data must be recorded on the same row with the same database, so when you click the next button on the first form, the user will be directed to the second one, but I want not to record first its values on the database, because records/data of the first and the second form must be of the same row and I want them to be inserted on my database when you hit the save button on the second form, the issue here is that, how can i pass the data of the first form to the second one without recording those data on the database yet? 我的项目中有2个表单,并且它们的数据必须记录在同一数据库的同一行中,因此,当您单击第一个表单的下一个按钮时,用户将被定向到第二个表单,但是我不想记录首先将其值放在数据库中,因为第一种和第二种形式的记录/数据必须位于同一行,并且当您在第二种形式上单击保存按钮时,我希望将它们插入我的数据库中,这里的问题是,如何在不将那些数据记录到数据库的情况下将第一种格式的数据传递给第二种格式? Can anyone help me?Thanks a lot. 有人可以帮我吗?非常感谢。 :) :)

form1.php form1.php

<?php
session_start();
if(isset($_SESSION['name'])):
    header("Location: http://mysite.ext/form2.php");
else:
?>
<form action="form2.php" method="POST" name="form1">
    <input type="name" name="name"/><br/>
    <input type="submit" value="Submit"/>
</form>
<?php endif; ?>

form2.php form2.php

<?php
session_start();
if(!isset($_SESSION['name'])):
    header("Location: http://mysite.ext/form1.php");
elseif(isset($_POST['password'], $_SESSION['name'])):
    echo 'Thank you', $_SESSION['name'] ,'. We will verify your password, ', $_POST['password'],' now.';    
else:
?>
<form action="form2.php" method="POST" name="form2">
    <input type="password" name="password"/><br/>
    <input type="submit" value="Submit"/>
</form>
<?php endif; ?>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将数据传递到数据库? - How can I pass the data to database? PHP:将表单数据传递到第三个文件,而无需在第二个文件中进行更改 - PHP: Pass on form data to a third file without changing it in the second file 如何首先验证多个文件,然后仅在它们有效时将其余的表单数据添加到数据库中? - How can I validate multiple files first and add the rest of the form data to the database only if they're valid? 如何将表单数据传递给我的 controller,然后将其存储到数据库中? laravel - How can I pass form data to my controller and then store it to database ? laravel 无法在数据库中第二次添加数据但第一次成功 Laravel - Cannot Add Data for the Second Time in Database but The First One Successful Laravel 如何在没有PHP的情况下用PHP和Javascript将数据从一页传递到另一页? - How can I pass data from one page to another in PHP and Javascript without from? 我可以从第二个表单提交并保留第一个表单的POST数据吗? - Can I submit from a second form and retain POST data from the first? 我如何在一个页面中使用2个表单,以及在单击第一个提交按钮时如何以第二个表单显示某些内容 - How i can use 2 forms in one page and when click in first submit button show something in second form 如何将数据从jQuery传递到php以保存到数据库中? - How can I pass data from jQuery to php for saving into a database? 如何将数据存储到数据库中? (一对一关系Laravel) - How can I store data into database? (One to One Relationship Laravel)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM