【发布时间】:2012-05-20 18:28:48
【问题描述】:
问题如下:
文件 1 的名称为:Lesson 17_Forms - Simple Form.php
和
文件 2 的名称为:Lesson 17_Forms - Process.php
文件1的内容如下:
<html>
<title>Lesson 17_Forms - Simple Form</title>
<head>
<center><h1>Lesson 17_Forms - Simple Form</h1></center>
</head>
<body>
<form action= "Lesson 17_Forms - Process.php" method="post">
Username: <input type="text" name="username" value="" />
<br />
Password: <input type="password" name="password" value="" />
<br />
<input type="submit" name="submit" value="Submit" />
</form>
</body>
</html>
文件2的内容:
<html>
<title>Lesson 17_Forms - Process</title>
<head>
<center><h1>Lesson 17_Forms - Process</h1></center>
</head>
<body>
<?php
// Ultra-simple form processing
// Just retrieve the value and return it to the browser
$username = $_POST['username'];
$password = $_POST['password'];
echo "{$username}: {$password}";
?>
</body>
</html>
两个文件都在同一个目录中,当我尝试通过单击提交按钮来处理表单时,我收到以下错误:
找不到对象!
在此服务器上找不到请求的 URL。上的链接 引用页面似乎是错误的或过时的。请告知作者 关于错误的那个页面。
如果您认为这是服务器错误,请联系网站管理员。
错误 404
localhost 2012 年 5 月 12 日星期六 02:40:39 PM EEST Apache/2.2.21 (Unix) DAV/2 mod_ssl/2.2.21 OpenSSL/1.0.0c PHP/5.3.8 mod_apreq2-20090110/2.7.1 mod_perl/2.0.5 Perl/v5.10.1
非常感谢任何建议。
【问题讨论】:
-
两个文件在同一个目录吗?
-
另外,
head标签上不应有任何“可见”元素。您的标题 (<h1>) 应该进入正文。此外,<center>不情愿。使用 CSS。 -
如果文件名中不使用空格怎么办?
-
@Truth:他真的什么都做不了,而你现在让他承受着他在不久的将来无法理解的事情
-
@CompilingCyborg: 你提交表单后看到了什么url?