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


passing text entered in a textbox to three other pages

我正在尝试创建三个页面,当在文本框中输入名称并单击按钮到下一页时,它会要求确认输入的名称是否正确,然后单击下一步按钮转到最后一页。 输入的文本应从第一页转移到第二页,然后是第三页。 我必须在代码中使用"隐藏"以及"标头"以及"POST"。

到目前为止,这是我在第一页上的内容:

<? $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>

这是我在下一页上得到的:

<?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>

这就是我在最后一页上得到的...请帮忙! 谢谢!

<!--
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>

如果没有要发送的输入,为什么最后一页上有一个表单?

此外,在第一行中它应该是:

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

它应该是这样的:

<?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>

页1.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>

呵。