0

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?

3
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by network18
0

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!

0

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.

0

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

0

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
}

Edited by mike_2000_17: Fixed formatting

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.