Testchecklist2
$style='V';//can be 'V'ertical or 'H'orizontal $lineBreak=($style=='V')?'
':''; $name='colors';//the name of your options $Legent="Select your $name";//dress it up in a nice fieldset with a ledgent $options=array('red','green','blue','orange','yellow','white','black'); $boxes='';//innitiate the list of tickboxes to be generated if(isset($_REQUEST["$name"])){ //we shall use $_REQUEST but $_POST would be better $Checked=$_REQUEST["$name"]; }else{ $Checked=array(); } foreach($options as $option){ $checkmark=(in_array($option,$Checked))?'checked':''; $nameAsArray=$name.'[]';//we would like the returned data to be in an array so we end with [] $boxes.=($style=='V')?"$option : ":"$option "; $boxes.="$lineBreak"; } echo<<
EOF ;