Can anyone knows how to insert date of birth and gender values of a particular user into the database?
They are included in a registration form.
Thank You,
Heshan.
php form values into a databse
Moderator: General Moderators
Re: php form values into a databse
theform.htm
usetheform.php
again... google 'php sanitize form input'. or search here on the forums.
If you dont know how to get a connection to your DB then go to http://www.w3schools.com/PHP/php_mysql_connect.asp.
this should help you in the right direction.
Code: Select all
<form method='post' action='usetheform.php'>
<input type='text' name='dob'>
<input type='text' name='gender'>
<input type='submit' name='submit'>
</form
Code: Select all
//open database connection
//set variables from form (this is a good time to sanitize them (google 'php sanitize form input'))
$dob = $_POST['dob'];
$gender= $_POST['gender'];
//execute this sql statement
INSERT INTO users (dob,gender) VALUES ({$dob}, {$gender}
If you dont know how to get a connection to your DB then go to http://www.w3schools.com/PHP/php_mysql_connect.asp.
this should help you in the right direction.