HTML 表单 PHP 帖子不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8145812/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
HTML form PHP post not working
提问by singerng
I'm writing a little website for myself and I'm having trouble with what seems like a simple line of code:
我正在为自己编写一个小网站,但在使用看似简单的一行代码时遇到了麻烦:
form action="send.php" method="post"
Furthermore, even a simple line like form action="http://www.google.com">
isn't working. Here is my code:
此外,即使是一条简单的线form action="http://www.google.com">
也行不通。这是我的代码:
<html>
<head>
<title>
AnonMail!
</title>
</head>
<body style="font-family:'Tahoma';>
<form action="send.php" method="post">
<label for="from">From: </label><input type="text" name="from" id="from"></input></br>
<label for="to">To: </label><input type="text" name="to" id="to"></input></br>
<label for="subj">Subject: </label><input type="text" name="subj" id="subj"></input></br>
<textarea rows=10 cols=100 name="message"></textarea></br>
<input type="submit" value="Send"/>
</form>
</body>
</html>
采纳答案by Duke Hall
Here's a form that should work:
这是一个应该有效的表格:
<html>
<body>
<form action="contact.php" method="post">
<p><b>Your Name:</b> <input type="text" name="yourname" /><br />
<b>Subject:</b> <input type="text" name="subject" /><br />
<b>E-mail:</b> <input type="text" name="email" /><br />
Website: <input type="text" name="website"></p>
<p><input type="submit" value="Send it!"></p>
</form>
</body>
</html>
If you're still having troubles: http://myphpform.com/php-form-not-working.php
如果您仍然遇到问题:http: //myphpform.com/php-form-not-working.php
回答by AbuHuraira Lakdawala
The error starts with your body tag.
You have not closed your double quotes in the style tag of your body.
Just close it properly and then run it.
I think that is only the problem.
错误从您的 body 标签开始。
你没有在你的 body 的 style 标签中关闭你的双引号。
只需正确关闭它,然后运行它。
我认为这只是问题所在。
回答by U?ur Gümü?han
browsers show warnings when your action refers to an external source. Some browsers do not post form at all. This is unsafe for users.
当您的操作涉及外部源时,浏览器会显示警告。有些浏览器根本不发布表单。这对用户来说是不安全的。