How do I insert multiple checkbox values into MYSQL?

Here is my html code

select programing languages that you know: PHP < input type="checkbox" name="TECH[]" value="PHP" > JAVA < input type="checkbox" name="TECH[]" value="JAVA" > JSP < input type="checkbox" name="TECH[]" value="JSP" > HTML < input type="checkbox" name="TECH[]" value="HTML" > < input type="submit" name="submit" value="SUBMIT" > < /form >
Junior Developer Asked on January 26, 2017 in PHP.
Add Comment
1 Answer(s)

@Suresh you can try the below code

<?php $checkbox=$_REQUEST['TECH'];
$languages="";
foreach($checkbox as $langs)
{
$languages.= $langs.",";
}
$sql= "insert into tablename set languages ='".$languages."'";
 
?>
 
Team Leader Answered on January 26, 2017.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.