I need help php code to identify my checkbox value insert in to some spesific coloumn, my form like this.
Create this php code
<?php
mysql_connect('localhost', 'username', 'password');
mysql_select_db('myTable');
$val = array();
if (isset($_POST['A']))
$val[] = $_POST['A'];
if (isset($_POST['B']))
$val[] = $_POST['B'];
if (isset($_POST['C']))
$val[] = $_POST['C'];
$value = implode(', ', $val);
if (isset($_POST['select'])) {
$col = $_POST['select'];
if ($col == 'Category 1') {
$query = mysql_query('INSERT INTO myTable(cat1) VALUES($value)');
}
else if ($col == 'Category 2') {
$query = mysql_query('INSERT INTO myTable(cat2) VALUES($value)');
}
else if ($col == 'Category 3') {
$query = mysql_query('INSERT INTO myTable(cat3) VALUES($value)');
}
}
?>