user3717206 user3717206 -4 years ago 66
HTML Question

Connecting PHP source code and submit form to MySQL Database

I'm trying to learn PHP and I'm trying to connect a MySQL database with my PHP code to make a submit form that lets me input data into the database. My problem is that the source code is connecting but the HTML isn't posting the variables to the PHP file. I could really use some help.

This is my HTML source code


<title>Form Input Data</title>


<table border="1">
<td align="center">Form Input Employees Data</td>
<form action="input.php" method="POST">
<td><input type="text" name="name" size="20">
<td><input type="text" name="address" size="40">
<td align="right"><input type="submit"
name="submit" value="Sent"></td>

And this is my PHP source code


$user_name = "fees0_14446440";
$password = "********";
$database = "fees0_14446440_addressbook";
$server = "";



$order = "INSERT INTO Trial

(name, address)




$result = mysql_query($order);


echo("<br>Input data is succeed");

} else{

echo("<br>Input data is fail");


Answer Source

You can find the POST data in PHP's $_POST variable. It should hold all the values that were passed via the POST method.

$name = $_POST["name"];

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download