OK, I wrote a script that adds a few fields from the form that is submitted to the MySQL database, but I do not think the script falls within "good programming form".
Let's say I have the following: <FORM never ming the rest> <INPUT TYPE=TEXT NAME="name"> <INPUT TYPE=TEXT NAME="age"> <INPUT TYPE=TEXT NAME="occupation"> </FORM>
What is the best way to add this information to the database?
<FORM method="post" action="/posting form page.php <INPUT TYPE=TEXT NAME="name"> <INPUT TYPE=TEXT NAME="age"> <INPUT TYPE=TEXT NAME="occupation"> </FORM> Posting form Page.php <? $name = $POST["name"]; $age = $POST["age"]; $occupation = $_POST["occupation"]; Make a connection to the mysql server then to the database the sql statement $sql = "INSERT INTO database (name, age, occupation) VALUES ('$name','age','occupation'); execute sql query and get result
Exact code depends on your db structure. But the concept is the same, an INSERT, perhaps? 😉 😃
$sql="insert into $tablename(user_name, user_age, user_job) values ('$name', '$age', '$occupation'); mysql_query($sql);