Hello friend, I want to insert the values of the checkbox when checked and then click the button.After clicking the button all the checked checkbox values will be inserted into the database. My code form.php
Hi Pintu, If you are talking about group of checkbox with same name and you want to insert values of those checkbox which is checked, then you have to write following script to retrive values of those checkbox.
<?php $checkBox = $_POST['things']; for($i=0; $i<sizeof($checkBox); $i++){ $query = "INSERT INTO table(things) values('".$checkBox[$i]."')"; mysql_query($query) or die(mysql_error()); } ?>
If this is not correct answer then please clarify your question that what you want to do with multiple checkbox in php.
Join MindStick Community
You need to log in or register to vote on answers or questions.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
$query= "INSERT INTO individual_skills(Skills_ID,Ind_ID) VALUES (" .$skills[$i]. ",".$_SESSION['Ind_ID'].")";
for ($i=0; $i<sizeof($skills);$i++) {
$query.= " VALUES (" .$skills[$i]. ",".$_SESSION['Ind_ID'].")";
}
In this code, you've done a little mistake in 'form.php' file. Replace your code with following code:
'form.php' Code:
Please marked as answer if this code will solve your problem.
I want to insert the values of the checkbox when checked and then click the button.After clicking the button all the checked checkbox values will be inserted into the database.
My code
form.php
checkbox.php
config.php
Please help me iam new to php.
Thanks
If you are talking about group of checkbox with same name and you want to insert values of those checkbox which is checked, then you have to write following script to retrive values of those checkbox.
If this is not correct answer then please clarify your question that what you want to do with multiple checkbox in php.