user enters corresponding data to form, they submit, and form data should post to my database. when the user hits submits I get the 405 HTTP error. I posted in Stackoverflow and someone mention that my methods were not enabled. So I navigated to http.conf file and I tried to enable them. But still no luck. Can some please help me. I am new to XAMPP. I truly believe that XAMPP is not connect correctly.
Here is my Form code:
- Code: Select all
<form action="DBWriteTo.php" name="clientInterest" method="post">
<h1>First & Last Name:</h1>
<input type="text" name="firstName" placeholder="Please Enter First Name"/>
<input type="text" name="lastName" placeholder="Please Enter Last Name"/>
<h2>Company Name:</h2>
<input type="text" name="companyName" placeholder="Enter Company Namee"/>
<input type="text" name="phone" placeholder="enter phone number"/>
<h3>What type of Service:</h3>
<input type="radio" id="basic" name="typeOfService"/><br>
<label for="basic">Basic</label>
<input type="radio" id="deluxe" name="typeOfService"/><br>
<label for="radio">Deluxe</label>
<input type="radio" id="premuim" name="typeOfService"/><br>
<label for="premuim">Premuim</label>
<h4>e-mail:</h4>
<input type="text" name="email" placeholder="Enter email" />
<input type="submit" name="clientInterest" value="Contact Us"/>
</form>
Here is my php code:
- Code: Select all
<?php
$firstName = $_REQUEST['firstName'];
$lastName = $_REQUEST['lastName'];
$companyName = $_REQUEST['companyName'];
$phone = $_REQUEST['phone'];
$email = $_REQUEST['email'];
$con = mysqli_connect('127.0.0.1:5500','root','','pclient');
//create DB connection
//CHECK CONNECTITON
IF($con->connect_error){
die('Connection Failed'. $con->connect_error);
}
echo 'CONNECTED!';
$sql = "INSERT INTO pclient VALUES ('$firstName','$lastName','$email','$companyName')";
if(mysqli_query($conn, $sql)){
echo "data stored in a database successfully navigate to your database to view the updated data";
}else{
echo "error saving data Sorry $sql"
. mysqli_error($conn);
}
mysqli_close($conn);
?>
This is where I tried to enable to methods:
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:@@Port@@
# XAMPP
ServerName localhost
#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
<Directory />
AllowOverride All
<Limit GET HEAD POST PUT DELETE OPTIONS>
Order Allow,Deny
Allow from all
</Limit>
</Directory>
***i tried to upload a picture but did know how. But i copied and pasted what I updated in the http.conf file.