HTTP错误405.0 - 不允许的方法,使用POST [英] HTTP Error 405.0 - Method Not Allowed, with POST

查看:2092
本文介绍了HTTP错误405.0 - 不允许的方法,使用POST的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的php文件中使用 isset($ _ POST ['Save'])将结果保存到数据库中。

I am trying to use isset($_POST['Save']) in my php file to save result in database.

echo "<form action='' method='POST'>";
echo "<input name='Save' type='submit' value='Save Result'>";
echo "</form>";
if(isset($_POST['Save']))
{
    include('saveResult.php');
}

saveResult.php:

saveResult.php:

<?php
if(isset($_POST['Save'])) // If the submit button was clicked
{
$serverName = "Alaa";
echo"saveResult function php";
$connectionInfo = array( "Database"=>"i2b2blast", "UID"=>"i2b2blast", "PWD"=>"demouser");
$conn = sqlsrv_connect( $serverName, $connectionInfo);

if( $conn ) {
     echo "Connection established.<br />";
}else{
     echo "Connection could not be established.<br />";
     die( print_r( sqlsrv_errors(), true));
}

$sql = "INSERT INTO BlastQueryDim (QueryID, QuerySeq) VALUES ('9', 'q')";

$stmt = sqlsrv_query( $conn, $sql);
if( $stmt === false ) {
     die( print_r( sqlsrv_errors(), true));
}
}
?>

但是,我收到此错误:


HTTP错误405.0 - 不允许的方法由于使用了无效的方法(HTTP动词)
,因此无法显示您要查找
的页面。
发送到Web服务器的请求使用了配置为处理请求的模块不允许的HTTP谓词。
向包含无效HTTP谓词的服务器发送了一个请求。
请求是针对静态内容的,并且包含除GET或HEAD之外的HTTP谓词。
使用HTTP谓词POST将请求发送到虚拟目录,默认文档是不支持GET或HEAD以外的HTTP谓词的静态文件。

HTTP Error 405.0 - Method Not Allowed The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used. The request sent to the Web server used an HTTP verb that is not allowed by the module configured to handle the request. A request was sent to the server that contained an invalid HTTP verb. The request is for static content and contains an HTTP verb other than GET or HEAD. A request was sent to a virtual directory using the HTTP verb POST and the default document is a static file that does not support HTTP verbs other than GET or HEAD.

请帮忙吗?

推荐答案

语法错误。

试试这个:

There is a syntax error.
Try this:

    include 'filename';

这篇关于HTTP错误405.0 - 不允许的方法,使用POST的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆