Input multiple checkboxes to MySQL
PHP
//class
//function
class Plan_Process {
function do_plan($visible, $plan_submit) {
if(isset($plan_submit)) {
//print_r($visible);
//exit();
$visible = implode(',', $visible);
$query = &SadoFactory::getInstance();
$query->insert('plans',
array('visible_to' => $visible)
);
echo " PLAN CREATED.";
} // eof if $submit
} }
FUNCTION: top of page
//process
$Plan_Process = new Plan_Process;
$Plan_Process->do_plan($_POST['visible'], $_POST['plan_submit']);
HTML
//form area
<form method="post" enctype="multipart/form-data">
<input type="checkbox" name="visible[vip]" value="VIPs"> VIPs
<input type="checkbox" name="visible[friends]" value="Friends"> Friends
<input type="checkbox" name="visible[family]" value="Family"> Family
<input type="checkbox" name="visible[biz]" value="Business"> Business
<input type="checkbox" name="visible[exs]" value="Exs"> Exs
Written by Wayne Roddy
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#