【发布时间】:2014-02-22 10:00:23
【问题描述】:
所以我试图简单地将一个数据字段从表单发送到 php 文件。下面是我在表格中的表格。我还发布了我的 php 代码。它不断返回 $username 为空。我已经尝试过发布/获取,但这似乎并不重要。
HTML:
<form action='http://k9minecraft.tk/scripts/adduser.php' method='POST'>
<table>
<tr>
<td>First Name:</td>
<td><input type='text' id='first'></td>
</tr>
<tr>
<td>Last Name:</td>
<td><input type='text' id='last'></td>
</tr>
<tr>
<td>Email:</td>
<td><input type='text' id='email'></td>
</tr>
<tr>
<td>Minecraft Name:</td>
<td><input type='text' name='user'></td>
</tr>
<tr>
<td><input type='submit' value='Send'></td>
<td><input type='reset' value='Reset'></td>
</tr>
</table>
</form>
PHP:
<?php
print_r($_POST);
if (isset($_POST['user'])) {
$username = $_POST['user'];
echo $username;
echo 'username is not null';
}
?>
【问题讨论】:
-
尝试
print_r($_POST),并将其发布在您的问题中 -
如果这是您要查找的内容,我会将其添加到我的问题中。解析错误:语法错误,第 3 行 /hermes/waloraweb097/b516/moo.bondsolutionsnjcom/k9minecraft/scripts/adduser.php 中的意外 T_VARIABLE
-
你有语法错误,你能做到没有语法错误吗???
-
不知道为什么这一行是语法错误。 $username = $_POST['user'];
-
把它放在第一行之前。
print_r($_POST);die;