Man of Honour
Not quite my programming arena , but my son is having an issue with a form submission while trying to update a MYSQL database.
We keep getting the following error:
Using a simple table called contactdata, with just an ID and first name.. for now.
index.html
demo.php
Web.config
Google's plenty of possible solutions, but none have managed to resolve this.
Any idea would be greatly appreciated.
We keep getting the following error:
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.
Using a simple table called contactdata, with just an ID and first name.. for now.
index.html
HTML:
<html>
<head>
</head>
<body>
<div class="container">
<form action="demo.php" method="post" >
<p>firstname: <input type="text" name="firstname" /></p>
<input type="submit" value="submit" />
</form>
</div>
</body>
</html>
demo.php
PHP:
<?php
$servername = "localhost";
$username = "root";
$password = "Passwordtbc";
$db = "contactdata";
$con = new mysqli($servername, $username, $password, $db);
if ($con->connect_error) {
die("Connection failed " . $con->connect_error);
}
echo 'Connected Sucessfuly';
$Value = $_POST["firstname"];
$sql = "INSERT INTO contactdata (firstname) VALUES ('$Value')";
if ($con->query($sql) === TRUE) {
echo "Records updated: ";
} else {
echo "Error: " . $sql . "<br>" . $con->error;
}
$con->close();
?>
Web.config
Code:
<?xml version="1.0"?>
<configuration>
<!--
For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.
The following attributes can be set on the <httpRuntime> tag.
<system.Web>
<httpRuntime targetFramework="4.5" />
</system.Web>
-->
<system.web>
<compilation debug="true" targetFramework="4.5"/>
<pages controlRenderingCompatibilityVersion="4.0"/>
</system.web>
</configuration>
Google's plenty of possible solutions, but none have managed to resolve this.
Any idea would be greatly appreciated.