Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/273.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP表单示例只生成空白页面_Php_Html_Forms - Fatal编程技术网

PHP表单示例只生成空白页面

PHP表单示例只生成空白页面,php,html,forms,Php,Html,Forms,软件/应用程序:记事本++6.5,谷歌Chrome版本26.0.1410.64 m 我在线复制了一段代码,只是为了测试表单是如何工作的,这样我就可以将它映射到我的真实页面上。 但即使我尝试了在线示例代码,它在我这方面仍然不起作用。有人能告诉我这背后的原因吗 copypaste.php <html><body> <form action="DesignPageProcess.php" method="POST"> <p>Your name: <

软件/应用程序:记事本++6.5,谷歌Chrome版本26.0.1410.64 m

我在线复制了一段代码,只是为了测试表单是如何工作的,这样我就可以将它映射到我的真实页面上。
但即使我尝试了在线示例代码,它在我这方面仍然不起作用。有人能告诉我这背后的原因吗

copypaste.php

<html><body>
<form action="DesignPageProcess.php" method="POST">
 <p>Your name: <input type="text" name="name"/></p>
 <p>Your age: <input type="text" name="age" /></p>
 <p><input type="submit" value="submit" name="submit" /></p>
</form>
</body></html>

您的姓名:

您的年龄:

DesignPageProcess.php

<html><body>
<?php

if ($_POST['submit'] == "submit") 
{
   $name = $_POST['name'];

   echo "asd".$name.;

   // - - - snip - - - 
}
?>
</body></html>

它返回一个空白页。

删除多余的页面

<html><body>
<?php

if($_POST['submit'] == "submit") 
{
   $name = $_POST['name'];

  echo "asd".$name; //Removed the extra . on this line

   // - - - snip - - - 
}
?>
</body></html>

试试:


添加PHP错误报告此问题似乎与主题无关,因为它与打字错误有关。您为什么使用记事本++?考虑使用一些更智能的软件,比如IDE吗?NetBeans正在尖叫着要这一行
echo“asd”。$name你不需要对语法错误给出StackOverflow答案,而是通过使用适当的软件来捕获它们。为什么你不使用更简单的工具,比如记事本+,并为自己添加一个完整的PHP IDE?@bew你没有运行web服务器吗?PHP是一种服务器端语言。对于回复,我尝试删除“.”并尝试复制代码,但仍然返回空白页。它们也在同一个文件夹中,仍然不走运:(这是你文件的全部内容吗?@bew在修复错误时对我很有用。@Stijn我想他没有发布整个文件,还有更多语法错误。@Charliepryn这是整个文件,正如我告诉你的,我从internet复制了整个代码并尝试了它
if(isset($_POST['submit'])) 
{
   $name = $_POST['name'];

  echo "asd".$name;

   // - - - snip - - - 
}