View Full Version : saving form data in mysql

12-23-2006, 04:23 PM
hello. i have a question regarding php forms and mysql. it's a registration form and i want all the data input by user is saved in the mysql db. all i know is, the form fields should be declared like this :

$state = $_POST['state'];

<input name="state" type="text" id="state" value="<?php echo $state; ?>">

once the user type in the state, i want the value to be stored in the db. how do i do this? are the statements above correct?

for dropdown menu, for example date of birth, i have 3 dropdown, for day, month and year. after selecting the value, it should be stored in the db. but now, dropdown menu contains few options, then what value should i put in the "value" attribute for each dropdown option?

can anyone help me with this? thank you so much, will really appreciate it

12-23-2006, 05:35 PM
look at the tutorial videos,

inserting data videos will show you how to enter values into a database from a form.

use the drop down videos to see how to build the drop down menu, then use what you have learn from the inserting data videos to take the values from the drop down lists

01-10-2007, 04:35 PM
hie, thanks alot for your reply.

i managed to save form details in the db. i'm now having problems only with radio buttons. when i choose a radio button, i want the value to be stored in the db but i did not manage to do that. can anyone help me on this? thanks alot

01-10-2007, 06:23 PM
your radio buttons will have the same name so catch the value in the same way with a $_POST

if you have 3 radios then each value would be different but the name would be the same. This $_POST will insert into 1 field into your db