Hello,
Checkbox problem. Trying to save the selection or selectinos user would make to a database.
table columns: desk, computer, whiteboard, chair, phone.
As you can see from the code below the users have 5 choices.
Here's the problem, i can't seem to wrap my head round how to save the data if a user happens to
pick just 2 maybe 3 items from the list of options and turn round and save the data under there respective columns in the table.
example, if the user selects computer and a chair, i like to update the computer and the chair columns in the table.
any help you can provide would be greatly appreciated.
note: connection to the database are working.
<?php
if($_POST["button"] == "button")
$office = $_POST['office'];
//$insert1 = "INSERT INTO test_location (desk,computer,whiteboard,chair, phone) VALUES(???);
?>
<html>
<body>
<h2> what do you need for your office: </h2>
<form name="checkbox" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<input type="checkbox" name="office[]" value="desk"> Desk
<input type="checkbox" name="office[]" value="computer"> Computer
<input type="checkbox" name="office[]" value="whiteboard"> whiteboard
<input type="checkbox" name="office[]" value="chair"> Chair
<input type="checkbox" name="office[]" value="phone"> Phone
<br>
<input type="submit" value="Submit" name="button">
</form>
</body>
</html>