<form method="post" action="abc.php"><?php for ($i = 0 ; $i < 10 ; $i++) { ?><INPUT type="checkbox" name="idlist[]" value="<?php echo $i;?>">Chon<?php}?><input type="submit" name="submit" value="submit"></form>
<?php$idlist = $_POST["idlist"];for($i = 0; $i < sizeof($idlist); $i++) { $key_id = $idlist[$i]; INSERT VO Database }?>
Cho các giá trị của check vào trong 1 trường? Sao làm thế dc? Huh
<form method=post action="" ><p class="style3">Course Information :</p> <? $course=implode("-",$_POST["ci"]); echo $course vậy là ?> <table width="100%" border="0" bgcolor="#CCCCCC"> <tr> <td width="36%"><label> <input type="checkbox" name=ci[] value=EfL /> English for Life</label></td> <td width="38%" rowspan="4"><label> <input type="checkbox" name=ci[] value=IELTS /> IELTS Exam Preparation</label></td> <td width="26%"><label> <input type="checkbox" name=ci[] value=Speaking /> Speaking</label></td> </tr> <tr> <td rowspan="2"><label> <input type="checkbox" name=ci[] value=EfS /> English for Study</label></td> <td><label> <input type="checkbox" name=ci[] value=Writing /> Writing</label></td> </tr> <tr> <td><label> <input type="checkbox" name=ci[] value=Reading /> Reading</label></td> </tr> <tr> <td><label> <input type="checkbox" name=ci[] value=EfP /> English for Professional</label></td> <td><label> <input type="checkbox" name=ci[] value=Listening /> Listening</label></td> </tr> </table> <input type=submit name=submit value="Submit" /></form>
<?php$ci = $_POST["ci"];$giatri = "";for($i = 0; $i < sizeof($ci); $i++) { $key_id = $idlist[$i]; $giatri .= ",".$key_id;}?>
<?php $course = $_POST['ci']; for($i = 0; $i < sizeof($course); $i++) { switch ($course[i]) { case 'ELF': //UPDATE truong ELF thanh 1 break; case 'IELTS': //UPDATE truong IELTS thanh 1 break; case 'Speaking': //UPDATE truong Speaking thanh 1 break; //... } } ?>
<?phpfunction convert_date_to_mysql($date) { if (!empty($date)) { $patterns = array ("/(\d{1,2})\/(\d{1,2})\/(19|20)(\d{2})/"); $replace = array ("\\3\\4-\\2-\\1"); return preg_replace($patterns, $replace, $date); } return ""; }?>
<?php function convert_date_from_mysql($date,$break=false,$format="\\4/\\3/\\1\\2") { if (!empty($date)) { $patterns = array ("/(19|20)(\d{2})-(\d{1,2})-(\d{1,2})/", "/(\d{1,2}):(\d{1,2}):(\d{1,2})/"); $replace = array ($format, ($break?"<br>":"")."\\1h \\2' \\3\""); return preg_replace($patterns, $replace, $date); } return ""; }?>
<?phpfunction date_to_date($date) { $a = explode('/',$date); if(sizeof($a)==3) { return ($a[2].'/'.$a[1].'/'.$a[0]); } }?>