to every 1 have values in data base want display them check boxes. values should display when click @ button. should not in combo box. because want post multiple values @ 1 time. please thanks
<?php $womenlist=mysql_query("select * tbl_cycleduraion user_id=$_session[user_id]"); $gs=0; while($girlslist=mysql_fetch_array($womenlist)) { $gs++; ?> <li style="background-color:#ccc; width:150px;"><label for="chk1"><input type="checkbox" name="chk_<?php echo $gs?>" id="chk<?php echo $gs?>" value="<?php echo $girlslist['calname'];?>" <?php if($_request['chk_'.$gs]==$girlslist['calname']){?> checked="checked"<?php }?>><?php echo $girlslist['calname']." ".$girlslist['caldesc']; ?> </label></li> <?php }?>
you limit number of columns in query (not select * ...
). you've put <input>
inside <label>
. <label>
's for=""
attribute hardcoded chk1
. take out inline style=""
on <li>
, put stylesheet. i've "tidied" bit (untested):
$womenlist = mysql_query("select * tbl_cycleduraion user_id=$_session[user_id]"); $gs = 0; while( $girlslist = mysql_fetch_array($womenlist) ) { $gs++; echo '<li style="background-color:#ccc; width:150px;">' . '<label for="chk' . $gs . '">' . $girlslist['calname'] . ' ' . $girlslist['caldesc'] . '</label>' . '<input type="checkbox" name="chk_' . $gs . '" id="chk' . $gs . '" value="' . $girlslist['calname'] . '" . (($_request['chk_'.$gs]==$girlslist['calname']) ? 'checked="checked"' : '') . '></li>'; }
Comments
Post a Comment