简体   繁体   中英

trying to post to php file - server error

I'm a newbie here to php and Apache. I have an html form:

<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."

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)

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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