douliaodan2738 2013-10-29 06:26
浏览 363

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

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>
  • 写回答

1条回答 默认 最新

  • douluo6626 2013-10-29 06:46
    关注

    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.

    评论

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看