【发布时间】:2014-12-30 21:31:40
【问题描述】:
需要帮助解决愚蠢的疑问,但我对此一无所知。
试图通过 POST 从一个网页传递到另一个网页(volunteer.php 到 confirmdata.php),但问题是我总是得到 null。
志愿者.php:
<form action="confirmdata.php" method="POST" enctype="multipart/form-data" name="form1" id="form1">
<fieldset>
<table width="415" cellpadding="1" cellspacing="0">
<tr>
<td width="108">Name:</td>
<td width="301"><label for="nome"></label>
<input name="nome" type="text" class="bgverdinho" id="nome" /></td>
</tr>
</table></fieldset></form>
现在在 confirmdata.php:
<li> <?php echo "Nome ".$nome = empty($_POST['nome']) ? null : $_POST['nome']; ?></li>
什么都没有,它返回 null 但是为什么它不将 'nome' 保存在 POST 变量中?
谢谢大家
【问题讨论】:
-
你是通过 apache 还是 nginx 或者其他方式运行这个?
-
你得到什么结果?为了使用 PHP,您应该安装像 Apache 这样的 PHP 服务器来处理页面。
-
尝试摆脱 enctype="multipart/form-data" 。我已经看到这会给某些人带来问题,这真的没有必要。