user3717206 user3717206 -4 years ago 59
HTML Question

Connecting PHP Code and Submit Form to mySQL Database

Hi 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 into the database. My problem is that the code is connecting but the html isn't posting the variables to the PHP file. I could really use some help. thanks

This is my Html 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 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