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.

    评论

报告相同问题?

悬赏问题

  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能