如何将PHP上的表单中的数据传递到另一个PHP的HTML中
我有两个php页面:如何将PHP上的表单中的数据传递到另一个PHP的HTML中,php,jquery,html,Php,Jquery,Html,我有两个php页面:info.php和thankyou.php 在info.php中,我有这样一个表单: <span class="help" style="padding-left:4%;">Νame as it appears on ID Card.</span> <label for="id_holder">ID Name :</label> <span action="../myaccount/Luhusian/tha
info.php
和thankyou.php
在info.php
中,我有这样一个表单:
<span class="help" style="padding-left:4%;">Νame as it appears on ID Card.</span>
<label for="id_holder">ID Name :</label>
<span action="../myaccount/Luhusian/thankyou.php" method="post" id="id_holder">
<input type="text" autocomplete="off" class="large" pattern=".{2,30}" maxlength="32" name="id_holder" value="" required="" title="ID fullname">
</span>
但是,当我尝试运行它时,会出现以下错误:
Thank you,
Notice: Undefined index: id_holder in C:\xampp\htdocs\thankyou.php on line 14
我想我上面的代码有问题吗。有谁能告诉我如何修复它吗?在info.php文件中,您应该使用表单而不是span
<form action="../myaccount/Luhusian/thankyou.php" method="post" id="id_holder">
<input type="text" autocomplete="off" class="large" pattern=".{2,30}" maxlength="32" name="id_holder" value="" required="" title="ID fullname">
</form>
但表单是块元素,我想这就是为什么要使用span。你可以
只需添加一个内联css(但我不推荐内联css)就可以创建内联元素
然后在感谢页面上,首先检查字段是否已设置,然后呈现页面
<?php if (isset($_POST['id_holder'])) : ?>
<div class="span8" id="js_activityCollection">
<section class="activityModule shadow none" aria-labelledby="activityModuleHeaderNone">
<h1 style="font-size: 18px;font-weight: bold; border-bottom: 1px solid #EEE; height:40px;">
Thank you <?php echo $_POST["id_holder"]; ?>
</h1>
</section>
</div>
<?php else : ?>
<p>Please fill in the form correctly</p>
<?php endif; ?>
非常感谢。
请正确填写表格
基于Web的表单通常需要表单标签。。。我不相信您可以将表单标记参数指定给SPAN标记,并使其行为类似于表单标记。。。请看
<form style="display:inline-block" action="../myaccount/Luhusian/thankyou.php" method="post" id="id_holder">
<input type="text" autocomplete="off" class="large" pattern=".{2,30}" maxlength="32" name="id_holder" value="" required="" title="ID fullname">
</form>
<?php if (isset($_POST['id_holder'])) : ?>
<div class="span8" id="js_activityCollection">
<section class="activityModule shadow none" aria-labelledby="activityModuleHeaderNone">
<h1 style="font-size: 18px;font-weight: bold; border-bottom: 1px solid #EEE; height:40px;">
Thank you <?php echo $_POST["id_holder"]; ?>
</h1>
</section>
</div>
<?php else : ?>
<p>Please fill in the form correctly</p>
<?php endif; ?>