Hie everybody, Iam trying to insert multiple rows into a table at the same time. The form fields of the rows are defined as checkboxes in html. For example it requires a person to enter his qualifications by ticking appropriate checkboxes. Now a person may tick more than one checkbox, and each of the selected values shouuld be stored as a separate tuple/row/column in the database . How can I do that?
Iam using php and mysql.
Any help guys?

Simply test using php if the checkbox was selected

if(isset($_POST['check-box-name'])){
//Do something

}

From there you can proceed with inserting the values to the database. Test for each checkbox

Happy times!

why do you want to store the each qualification checked by the single user in multiple rows.you can have a row par user having different columns to store that user details, like you can have a enum fields like qualification1, qualification2 etc.
Hope you got what i want to explain you.

Simply test using php if the checkbox was selected

if(isset($_POST['check-box-name'])){ //Do something

}

Thank u fathers 4 providing me with the code above. It worked perfectly and solved my problem, Now I've tried to use the isset function on textarea fields but it seems not working. Can you show me the way around?

Thanks....! Happyman Tidza[code=php]
if(isset($_POST)){
//Do something

}

Thank u fathers 4 providing me with the code above. It worked perfectly and solved my problem,
Now I've tried to use the isset function on textarea fields but it seems not working.
Can you show me the way around?

Thanks....!
Happyman Tidza

Simply test using php if the checkbox was selected
if(isset($_POST['check-box-name'])){
//Do something
}

Thank u fathers 4 providing me with the code above. It worked perfectly and solved my problem,
Now I've tried to use the isset function on textarea fields but it seems not working.
Can you show me the way around?

Thanks....!
Happyman Tidza

It is likely to have more than one html elements all the time, so the better way to do the same thing, after the form submit , is -

if(isset($_post['btnName']) && $_post['btnName'] )
{
$chkBoxValue = $_post['check-box-name'];
$textBoxValue = $_post['text-box-name'];
$textAreaValue =  $_post['text-area-name'];
//Do whatever with these values now
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.