5-6-5 ®Ö¨ú«ö¶s¡]Checkbox¡^
¡@¼ÊºÙ: ¤p»x ¡@ÀY»Î: ´¿¸g¤]¬O¤ô¹q¤u
ºÞ²zû
- ©«¤l
- 1190
- ¥DÃD
- 394
- ºëµØ
- 113
- ¿n¤À
- 1747
- ÂI¦W
- 1
- §@·~¨t²Î
- Vista
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 200
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2024-11-23
|
5-6-5 ®Ö¨ú«ö¶s¡]Checkbox¡^
5-6-5 ®Ö¨ú«ö¶s¡]Checkbox¡^
®Ö¨ú«ö¶s¡]Checkbox¡^¾A¥Î©ó¦h³Æ¿ï®×µª®×¥B¦h¥¿½Tµª®×¿ï¨úªº³õ¦X¡A¦p¦P½Æ¿ïªº¿ï¾ÜÃD¡A¨Ò¦p¿³½ì¡B¶Ý¦n¡Kµ¥¡G- <input type=¡¨Checkbox¡¨ name=¡¨ÃѧO¦W¡¨ value=¡¨¸ê®ÆÈ¡¨>
½Æ»s¥N½X »P³æ¿ï«ö¶s¬Û¦Pªº¬O¨Ï¥ÎªÌ¥u»ÝÂI¿ïµª®×¡A¤£»Ýn¶ñ¼g¸ê®Æ¡A©Ò¥H¥²¶·¬°¨C¤@Ó®Ö¨ú«ö¶s«Ø¥ß¤£¦Pªº¸ê®ÆÈ¡A¦Ó¥B¬°¤FÅý¦hÓ®Ö¨ú«ö¶s¦¨¬°½Æ¿ïªº¸s²Õ¡A¬G¦P¸s²Õ¤ºªº®Ö¨ú«ö¶s¨ä¡uname¡vÄÝ©ÊÈ¥²¶·¬°¬Û¦Pªº¡uÃѧO¦W¡v¡C
checkbox.php- <html><head>
- <title>®Ö¨ú«ö¶s¤¸¥ó¨Ï¥Î</title>
- </head><body>
- <form action="checkbox_ans.php" method="Post">
- ½Ð¿ï¾Ü±z³ßÅwªº¤ôªG:<Br>
- <Input type="Checkbox" name="food" value="»¿¼" Checked>»¿¼
- <Input type="Checkbox" name="food" value="Ä«ªG">Ä«ªG
- <Input type="Checkbox" name="food" value="ªÝ¼Ö">ªÝ¼Ö
- <Input type="Checkbox" name="food" value="»ñ±ù">»ñ±ù
- <Input type="Checkbox" name="food" value="¦è¥Ê">¦è¥Ê
- <Br>
- <input type="Submit">
- </form>
½Æ»s¥N½X Yn±N¬YÓ®Ö¨ú«ö¶s¹w³]¬°¤w¿ï¨ú¡A«h¥[¤J¡uChecked¡vÄݩʳ]©w§Y¥i¡C»P³æ¿ï«ö¶s³Ì¤jªº¤£¦P¬O®Ö¨ú«ö¶s¦b¿ï¨ú«á¡A¥i¥H¦AÂI¿ï¤@¦¸®Ö¨ú«ö¶s¨ú®ø¿ï¨ú¡C
¹Ï5-27 ®Ö¨ú«ö¶s½d¨Òcheckbox.php¡C |
|
¤ß¦w¡A¥¦w
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!
|
|
|
|
|
¡@¼ÊºÙ: ¤p»x ¡@ÀY»Î: ´¿¸g¤]¬O¤ô¹q¤u
ºÞ²zû
- ©«¤l
- 1190
- ¥DÃD
- 394
- ºëµØ
- 113
- ¿n¤À
- 1747
- ÂI¦W
- 1
- §@·~¨t²Î
- Vista
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 200
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2024-11-23
|
·í¦P®ÉÂI¿ï¦hÓ®Ö¨ú«ö¶s«á¡A¦]¬°¨CÓ®Ö¨ú«ö¶sªº¦WºÙ³£¬Û¦P¡A¦]¦¹¡A·í¸ê®Æ¶Ç°e«á¡A¨CÓ³QÂI¿ïªº®Ö¨ú«ö¶s¨ä¸ê®ÆȤ§¶¡·|¥H¤@Ó¡u¡A¡v³r¸¹»P¤@Ӫťզr¤¸¹j¶}¡A§ÚÌ¥i¥H§Q¥Î¡ustr_replace()¡v¨ç¼Æ¥[¥H´À´«¡C
¹Ï5-28 ®Ö¨ú«ö¶s½d¨Òcheckbox_ans.php¡C
checkbox_ans.php- <html><head>
- <title>®Ö¨ú«ö¶s¤¸¥ó¨Ï¥Î</title>
- </head><body>
- <?
- $myfood=$_REQUEST["food"];
- ?>
- ±zªº¿ï¾Ü(´À¥N«e):<?=$myfood?>
- <P>
- ±zªº¿ï¾Ü(´À¥N«á):<?=str_replace(",",";",$myfood)?>
- </body></html>
½Æ»s¥N½X |
|
¤ß¦w¡A¥¦w
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!
|
|
|
|
|
¡@¼ÊºÙ: ¤p»x ¡@ÀY»Î: ´¿¸g¤]¬O¤ô¹q¤u
ºÞ²zû
- ©«¤l
- 1190
- ¥DÃD
- 394
- ºëµØ
- 113
- ¿n¤À
- 1747
- ÂI¦W
- 1
- §@·~¨t²Î
- Vista
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 200
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2024-11-23
|
§AÄF¤H¡I§Ú¤£ºÞ¿ï¨ú´XÓ¶µ¥Ø¡A¥¦´N¬O¥u·|¥X²{³Ì«á¤@Ó³Q¿ï¨úªº¶µ¥Ø¡A¨þ¡A±zªº±¡§Î¬O¤£¬O¹³¹Ï5-28¤@¼Ë£«¡I³o¬OPHP¤¤ªº¤@Ó³´¨À¡A¹³®Ö¨ú¤è¶ô³oºØ¤¸¥ó¡A¥i¥H¤@ÓÃѧO¦WºÙ°O¿ý«Ü¦h¸ê®Æ¤º®eªºª¬ªp¡A§Ú̥Τ@ÓÃѧO¦W¨Ó³B²z·íµM¦æ¤£³q¡I¦]¦¹¡Aªí³æªº®Ö¨ú¤è¶ôÃѧO¦WÀ³¸Ón§â¥¦§ï¦¨°}¦C§Î¦¡¡G
checkbox_2.php- <html><head>
- <title>®Ö¨ú«ö¶s¤¸¥ó¨Ï¥Î</title>
- </head><body>
- <form action="checkbox_2_ans.php" method="Post">
- ½Ð¿ï¾Ü±z³ßÅwªº¤ôªG:<Br>
- <Input type="Checkbox" name="food[]" value="»¿¼" Checked>»¿¼
- <Input type="Checkbox" name="food[]" value="Ä«ªG">Ä«ªG
- <Input type="Checkbox" name="food[]" value="ªÝ¼Ö">ªÝ¼Ö
- <Input type="Checkbox" name="food[]" value="»ñ±ù">»ñ±ù
- <Input type="Checkbox" name="food[]" value="¦è¥Ê">¦è¥Ê
- <Br>
- <input type="Submit">
- </form>
- </body></html>
½Æ»s¥N½X ¬JµM®Ö¨ú¶µ¥Ø¤w¸g¦¨¬°°}¦CÅܼƪº¤¸¯À¡A¨º¸Ó¦p¦ó±N¤¸¯À¦C¥X©O¡H·Q°_¨Ó¤F§a¡I´N¬O§Ṳ́w¸g¤¶²Ð¹Lªºfor°j°é£«¡G
checkbox_2_ans.php- <html><head>
- <title>®Ö¨ú«ö¶s¤¸¥ó¨Ï¥Î</title>
- </head><body>
- ±zªº¿ï¾Ü:
- <?
- $myfood=$_REQUEST["food"];
- $num=count($myfood);
- for ($x=0; $x<$num; $x++)
- {
- echo "$myfood[$x] ,";
- }
- ?>
- </body></html>
½Æ»s¥N½X |
|
¤ß¦w¡A¥¦w
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!
|
|
|
|
|
¡@¼ÊºÙ: ¤p»x ¡@ÀY»Î: ´¿¸g¤]¬O¤ô¹q¤u
ºÞ²zû
- ©«¤l
- 1190
- ¥DÃD
- 394
- ºëµØ
- 113
- ¿n¤À
- 1747
- ÂI¦W
- 1
- §@·~¨t²Î
- Vista
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 200
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2024-11-23
|
¨Ï¥Îfor±Ôz¿é¥X°}¦C¤¸¯À¬O°ò¥»¥\¡AÃø´NÃø¦b¦p¦ó¦b¿é¥X®É¬°¨CÓ°}¦C¤¸¯À¶¡¥[¤J¤À¹j²Å¸¹¡A¹³¹Ï5-29¡A¬O¦b¨CÓ°}¦C¤¸¯À¶¡¥[¤J³r¸¹¤F¡A¥i¬O¡A³Ì«á¤@Ó¤¸¯À«á±«o¦h¤F¤@Ó³r¸¹¡A³o®ÉÔ¡A§ÚÌ¥i¥H§Q¥Î¡ujoin()¡v¨ç¼Æ¨Ó¸Ñ¨M¡G
checkbox_3_ans.php- <html><head>
- <title>®Ö¨ú«ö¶s¤¸¥ó¨Ï¥Î</title>
- </head><body>
- ±zªº¿ï¾Ü:
- <?
- $myfood=$_REQUEST["food"];
- echo join(",",$myfood);
- ?>
- </body></html>
½Æ»s¥N½X join()¨ç¼Æ¤£¶È¥i¦b¤¸¯À¶¡¥[¤J¯S©wªº¦r¦ê¡A¦P®É¤]±N°}¦C¤¤ªº¤¸¯À¤@¤@°µ¿é¥X¡A°£¤Fjoin()¨ç¼Æ¥~¡A¡uimplode()¡v¨ç¼Æ¥ç¦³¬Û¦P¥\¯à¡G
implode()¨ç¼Æ®æ¦¡- string implode ( string glue, array pieces)
½Æ»s¥N½X ¨Ò¦p:½d¨Òex5_15.php- <?
- $Myarray = array("¬K¤Ñ","®L¤Ñ","¬î¤Ñ","¥V¤Ñ");
- echo implode("<br>",$Myarray);
- //¿é¥X'¬K¤Ñ<br>®L¤Ñ<br>¬î¤Ñ<br>¥V¤Ñ'
- ?>
½Æ»s¥N½X |
|
¤ß¦w¡A¥¦w
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!
|
|
|
|
|
- ©«¤l
- 15
- ¥DÃD
- 4
- ºëµØ
- 0
- ¿n¤À
- 50
- ÂI¦W
- 0
- §@·~¨t²Î
- XP
- ³nÅ骩¥»
- 1998
- ¾\ŪÅv
- 20
- µù¥U®É¶¡
- 2010-11-15
- ³Ì«áµn¿ý
- 2013-7-10
|
¾Çªø,§Ú³oÓFUNCTION¥i¥H¼g±o¦A¦nÂI¶Ü
ÁÂÁÂ- function showgroup(){
- $sql = 'SELECT * FROM `group` LIMIT 20';
- $result = mysql_query($sql);
- while ($row = mysql_fetch_assoc($result))
- {
-
- echo $row['groupname']."'<input type='checkbox' name='perm[]' value='".$row['groupid']."'/>";
- }
- }
½Æ»s¥N½X |
|
|
|
|
|
|