【问题标题】:HTTP Error 405.0 - Method Not Allowed When I Try To Post a Form Into DatabaseHTTP 错误 405.0 - 当我尝试将表单发布到数据库时不允许使用该方法
【发布时间】:2013-06-08 10:30:32
【问题描述】:

我正在尝试将表单发布到 mysql 数据库中。我使用的是 Windows 8 和 iis 8,但是当我尝试发布表单时出现此错误 “您正在查找的页面无法显示,因为正在使用无效的方法(HTTP 动词)。”

我的html代码:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>odev3</title>
</head>
<body>
<form align="middle" action="insert.php" method="post">
Ad : <input type="text" name="ad" style="margin-left:60px" required/><br>
Soyad : <input type="text" name="soyad" style="margin-left:40px" required/><br>
Kullanıcı Adı : <input type="text" name="kullaniciadi" required/><br>
Şifre : <input type="text" name="sifre" style="margin-left:52px" required/><br>
<input type="reset" value="Temizle"/>
<input type="submit" value="Kaydol"/>
</form>
</body>
</html>

和我的 php 代码:

 <?php 
    $host="localhost";
    $user="root";
    $pass="123";

    mysql_connect($host,$user,$pass);

    mysql_select_db("odev3"); 

    $sql="INSERT INTO kisi(ad,soyad,kullaniciadi,sifre) VALUES ('$_POST[ad]','$_POST[soyad]','$_POST[kullaniciadi]','$_POST[sifre]')";

    $result = mysql_query($sql);
    if($result)
    {
      echo("<br> Veri eklendi.");
    }
    else
    {
      echo("<br> Veri eklenemedi.");
    }
?>

【问题讨论】:

  • 你发帖的时候会说吗?那么你得到的 URL 是什么?在此处发布错误网址
  • 是的,首先我看到表格并填写。当我单击提交按钮时,我得到了错误和这个网址:localhost:19853/insert.php

标签: php html


【解决方案1】:

你的服务器是 IIS 吗?什么是版本?

这可能有很多问题,但最常见的是您的 IIS 未配置为处理 PHP 类型的文件或 IIS 不知道动词 POST。有时只需使用 GET 即可,但最好尝试修复您的 IIS。

请查看以下链接:

【讨论】:

    猜你喜欢
    • 2016-07-16
    • 1970-01-01
    • 2012-06-29
    • 1970-01-01
    • 2016-06-27
    • 2018-02-16
    • 2014-06-18
    • 2012-08-26
    • 2012-02-23
    相关资源
    最近更新 更多