Hi! I would like to insert data in to table through user inter face. basic, right? I have two text boxes and i need to insert the data frsend the submitted info(that is written by the user) directly to database. Is it possible to connect to the server directly from the form (that contain the text boxes)? In the command: form action="process.php" method="post" HTML: The file-process.php is made to create the connection. But, Is it that the submitted info has to pass through another process file? can't the form action can be form action="mysql databse" HTML: thanx progfrog
on the page process.php you'll need to do something like this. Lets say for example your form as FName, LName, Age and Sex then your could do this. <? include_once("dbConnect.php"); //This file should hold all your DB connection information (User,Pass, Host, DBName) $fname = $_POST['FName']; $lname = $_POST['LName']; $age = $_POST['Age']; $sex = $_POST['Sex']; UpdateDB(); function UpdateDB(){ global $fname, $lname, $age, $sex; $tbl = "TABLENAME"; // Change this to your table name in your DB mysql_query("UPDATE $tbl SET FName='$fname', LName='$lname', Age='$age', Sex='$sex'") or die(); } mysql_close($con); // Closes the DB Connection (Provided you set $Con to the DB Information in the file dbConnect.php) ?> Code (markup): I went ahead and threw in the dbConnect.php code as well. //Please Change the values below to reflect your servers settings! $dbUser = "admin"; $dbPass = "mypass"; $dbName = "myDBName"; // Handles DB Connection DO NOT CHANGE CODE BELOW THIS LINE!!! $con = mysql_connect("localhost", $dbUser, $dbPass) or die(mysql_error()); mysql_select_db($dbName,$con) or die(mysql_error()); Code (markup): Obviously this could be more complex and involved but this is just a simple example showing how to update a mysql record. There are plenty of tutorials on the subject and the php manual is a invaluable resource. Simply type "PHP [COMMAND YOUR LOOKING FOR] Tutorial" in google and it should help you tremendously. In this case you would have searched for "PHP MYSQL UPDATE Tutorial" I hope this helps a bit