0

テキスト ボックスに名前を入力して次のページに移動するボタンをクリックすると、入力した名前が正しいかどうかを確認し、次のボタンをクリックして最後のページに移動する 3 つのページを作成しようとしています。 . 入力したテキストは、最初のページから 2 番目、3 番目のページに転送または通過する必要があります。コードでは、「非表示」、「ヘッダー」、および「POST」を使用する必要があります。

これまでのところ、1ページ目にあるものは次のとおりです。

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

1 に答える 1

1

送信する入力がない場合、最後のページにフォームがあるのはなぜですか?

また、最初の行では次のようにする必要があります。

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

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。

于 2013-10-29T06:46:11.123 に答える