Php code for inserting group checkbox data into the database
Can anyone plz tell me what php code should be used to insert checkbox group data into the database. I am trying to insert left or right value of placement field. the code is as follows,
<label>
<input type="radio" name="placement[]" value="L" id="placement" />
Left</label>
<br />
<label>
<input type="radio" name="placement[]" value="R" id="placement" />
Right</label>
and for inserting:
if (isset($_POST["placement"]))?implode(", ", $_POST["placement"]):"") {
$placement = array($_POST['placement']);
$placement1 = explode(",", $placement);
}
$qry = "INSERT INTO `member`.`test` (`userid`, `placement`)
VALUES ('$userid', '$placement1');";
$result = @mysql_query($qry);
Can you plz provide me with full code.