将文本框中输入的文本传递给其他三个页面

I am trying to create three pages that when a name is entered in a text box and the button is clicked to the next page, it will ask to confirm if the name entered is correct and to click the next button to go to the last page. The text entered should transfer or pass from the first page, to the second, then the third. I have to use "hidden" as well as "header" as well as "POST" in the code.

here is what I have on page one so far:

<? $things = array('one thing', 'two thing'); ?>




<form action= "page1.php" method="POST">
<INPUT TYPE="TEXT"  name="textbox">


    <input type='hidden' name='secret' value=96>
<input type='hidden' name='stuff' value='<?= urlencode(serialize($things)) ?> ' >
<input type='submit' name='submit_btn'>
</form>

This is what I got on the next page:

<?php
echo "Click next if your name is " . $_POST['textbox'];
  ?>
 <form action= "page2.php" method="POST"> 
<input type='hidden' name='secret' value=96>
<input type='hidden' name='stuff' value='<?= urlencode(serialize($things)) ?> ' >
<input type='submit' name='next' value ="next">
</form>

and this is what i got on the last page... please help! thank you!

<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
    <body>
        <form action= "page1.php" method="POST"> 
        <?php
        echo "Finally! Welcome " . $_POST['textbox'];
        ?>

        </form>

    </body>
</html>
douyinbo3361
douyinbo3361 为什么不使用会话?[sitepoint.com/php-sessions]
接近 7 年之前 回复
dongliyu3278
dongliyu3278 你有错误吗?一个问题?请准确的问题。
接近 7 年之前 回复

1个回答

Why do you have a form on the last page if there is no input to send?

Also, in the first line it should be:

<?php $things = array('one thing', 'two thing');?>

It should be like:

<?php $things = array('one thing', 'two thing'); ?>

<form action= "page1.php" method="POST">
<INPUT TYPE="TEXT"  name="textbox">


    <input type='hidden' name='secret' value=96>
<input type='hidden' name='stuff' value='<?= urlencode(serialize($things)) ?> ' >
<input type='submit' name='submit_btn'>
</form>

page1.php

<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
    <body>
        <?php
        echo "Finally! Welcome " . $_POST['textbox'];
        ?>
    </body>
</html>

HTH.

dougan4884
dougan4884 我在我的最后一页上尝试了你的代码,实际上是page2.php而不是page1.php ...它显示的任何方式:注意:未定义的索引:第14行的C:\ xampp \ htdocs \ lab14_q2test \ page2.php中的文本框最后! 欢迎它应该读:最后! 欢迎“在第一页的文本框中输入的文本”
接近 7 年之前 回复
dougang7521
dougang7521 页面也有错误,没有显示我的第二页,所以我更新了帖子。 TY!
接近 7 年之前 回复
dongxi5505
dongxi5505 大声笑,不确定,这整个形式的东西对我来说是陌生的,所以感谢您的耐心和帮助。 我认为我使用它的原因是从输入原始位置的第一页提取信息。
接近 7 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问