I have created a database in mysql called "test", and the table w/which I'm dealing is "employees". The objective of the example is to insert information into the table "employees", simple as that, but everytime the form try to send the info by the "post method" the info in the form elements never comes to the other page, is like if that info. get banned.
* my first page is called "forms-test01.php", and is as follows:
<html>
<body>
<form method="post" action="forms-test02.php">
First name:<input type="Text" name="first"><br>
Last name:<input type="Text" name="last"><br>
Address:<input type="Text" name="address"><br>
Position:<input type="Text" name="position"><br>
<input type="Submit" name="submit" value="Enter information">
</form>
</body>
</html>
* and the second one is called "forms-test02.php":
<?
$connect = mysql_connect("localhost", "user", "pass") or die("Could not connect to the server");
mysql_select_db("test", $connect) or die("Could not select database");
$query1 = "INSERT INTO EMPLOYEES (first, last, address, position) VALUES('$first', '$last', '$address', '$position')";
$result1 = mysql_query("$query1", $connect);
$query2 = "SELECT * FROM EMPLOYEES";
$result2 = mysql_query("$query2", $connect);
echo "<table border=1>";
echo "<tr><td>First</td> <td>Last</td> <td>Address</td> <td>Position</td></tr><br>";
$myrow = mysql_fetch_array($result2);
do
{
printf("<tr> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> </tr> <br>", $myrow["first"], $myrow["last"], $myrow["address"], $myrow["position"]);
}
while($myrow = mysql_fetch_array($result2));
echo "</table>";
?>
--------------------------------------------------------------------------------
I'm runing Apache 2.0.36, PHP 4.2.0 and MySQL 3.23.52 on Win XP Pro, thx for any help guys