Tuesday, February 3, 2009

use of checkbox


Selection one

Selection two

Selection three

Selection four

Selection five

Selection six

Selection seven



if(!isset($_POST)) exit();
$selections = (isset($_POST['selection']))?$_POST['selection']:NULL;
$count = count($selections);
if($count > 5 ¦¦ $count < 1) { //checks to see if they selected more than 5
echo 'Danger Will Robinson!';
exit();
}
$query = 'INSERT INTO table (attribute1,attribute2,attribute3,attribute4,attribute5) valueS (';
$add = "'".implode("','",$selections)."'";
for($i = 0; $i < 5-$count; $i++) {
$add .= ",NULL";
}
$query .= $add.')';
echo $query;
?>

No comments:

Post a Comment