带有下一个按钮的Web表单

时间:2014-11-03 21:07:32

标签: php html css ajax

所以,我正在创建一个简单的表单:

<tr>
  <td>
    <label for="FirstName">First Name <span class="req">*</span>
    </label>
    <br />
    <input type="text" name="FirstName" id="FirstName" class="cat_textbox" maxlength="255" />
  </td>
</tr>
<tr>
  <td>
    <label for="LastName">Last Name <span class="req">*</span>
    </label>
    <br />
    <input type="text" name="LastName" id="LastName" class="cat_textbox" maxlength="255" />
  </td>
</tr>
<input class="cat_button" type="submit" value="Submit" id="catwebformbutton" />

我希望它做的是当用户点击提交时,它会将他们带到另一个页面,在那里确认这些细节,或者只是向他们显示。有任何想法吗?或样本代码?

1 个答案:

答案 0 :(得分:0)

表格在哪里?我在你的代码中看不到任何形式!

尝试创建2个php文件

index.php文件

<form action="next_page.php" method="post">
    <table>
        <tr>
            <td>
                <label for="FirstName">First Name <span class="req">*</span></label>
                <br />
                <input type="text" name="FirstName" id="FirstName" class="cat_textbox" maxlength="255" />
            </td>
        </tr>
        <tr>
            <td>
                <label for="LastName">Last Name <span class="req">*</span></label>
                <br />
                <input type="text" name="LastName" id="LastName" class="cat_textbox" maxlength="255" />
            </td>
        </tr>

    </table>
        <input class="cat_button" type="submit" value="Submit" id="catwebformbutton"  />
</form>

next_page.php文件

$FirstName = $_POST['FirstName'];
$LastName  = $_POST['LastName'];

echo "first Name : ".$FirstName."<br>";
echo "last Name : ".$LastName."<br>";

你想用form form post和action form在其他页面做动作, 并使用$ _POST []

在另一个页面中发布数据

好的参考资料可能有助于学习这些东西: