这很奇怪,但我的表单没有传递POST数据。
这是表格
<form method="POST" action="process/processor.php">
<input name="name3" type="text">
<input type="submit" name="submit">
</form>
这是PHP
<?php
if(isset($_POST['submit']) AND $_SERVER['REQUEST_METHOD'] == "POST"){
$name = $_POST['name3'];
echo $name;
}
else{
echo 'lol';
}
?>
这是令人惊讶的地方
另一方面, var_dump($_POST)
提供了array(0) { }
,var_dump($_GET)
提供了rray(2) { ["name3"]=> string(6) "fghjmk" ["submit"]=> string(6) "Submit" }
看起来我使用GET
获取数据,而POST
没有数据。这对我来说很奇怪。有什么建议吗?
变量$name
答案 0 :(得分:0)
<form method="POST" action="process/processor.php">
<input name="name3" type="text">
<input type="submit" name="submit">
</form>
instead of <input type="submit" name="submit">, use <input type="submit" name="submit" value='submit'>
the $_POST['submit'] might be empty using <input type="submit" name="submit">. so, i think is not getting into the block code.