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 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记