简体   繁体   English

尝试发布到php文件-服务器错误

[英]trying to post to php file - server error

I'm a newbie here to php and Apache. 我是php和Apache的新手。 I have an html form: 我有一个HTML表单:

<html>
<body>

<?php
<form method="post" action="contact.php"> Email: <input name="email"
 type="text"/><br/> Message:<br/> <textarea name="message" rows="15" cols="40">
  </textarea><br/> <input type="submit"/> </form> 

</body>
</html> 

I have contact.php located in what I believe is the right place, but when I submit the query, I get "The HTTP verb POST used to access path '/www/contact.php' is not allowed." 我在我认为正确的位置放置了contact.php,但是在提交查询时,出现“不允许使用用于访问路径'/www/contact.php'的HTTP动词POST”。

When I access contact.php as a url I get strange results (like a repeating File Download message box asking whether I want to Save or Open) 当我将contact.php作为URL访问时,得到奇怪的结果(例如重复的文件下载消息框,询问我是否要保存或打开)

if you are using which is missing in your code. 如果您使用的是代码中缺少的内容。

for your below code will work. 为您下面的代码将工作。

<html>
<body>

<form method="post" action="contact.php"> Email: <input name="email"
 type="text"/><br/> Message:<br/> <textarea name="message" rows="15" cols="40">
  </textarea><br/> <input type="submit"/> </form> 
</body>
</html> 

First Thing Give Name to Submit Button and second remove 首先将名称命名为“提交”按钮,然后将其删除

<html>
<body>

<form method="post" action="contact.php"> Email: <input name="email"
 type="text"/><br/> Message:<br/> <textarea name="message" rows="15" cols="40">
  </textarea><br/> <input type="submit" name="submit" /> </form> 
</body>
</html> 

and if you can still face an error then try to give full file path in action 如果仍然遇到错误,请尝试提供完整的文件路径

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM