ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

5-6-6 ¤U©Ô¦¡¿ï³æ¡]Select¡^

5-6-6 ¤U©Ô¦¡¿ï³æ¡]Select¡^

5-6-6   ¤U©Ô¦¡¿ï³æ¡]Select¡^
¤U©Ô¦¡¿ï³æ¡]Select¡^¤¸¥ó¨ã¦³³æ¿ï«ö¶sªº¥\¯à¡A¥ç¨ã¦³®Ö¨ú«ö¶sªº½Æ¿ï¥\¯à¡A¤U©Ô¦¡¿ï³æ¤¸¥ó¥Ñ¡u<Select></Select>¡v¼ÐÅÒ©Òºc¦¨¡A¨ä¬°¤@­Ó¶°¦X¶µ¥Ø¤¸¥ó¡A¿ï³æ¤ºªº¨C¤@­Ó³Æ¿ï¶µ¥Ø¥²¶·¦A¨Ï¥Î¡u<Option></Option>¡v¥]¬A°_¨Ó¡G
  1. <Select name=¡¨ÃѧO¦W¡¨>
  2. <Option Value=¡¨¸ê®Æ¤@¡¨>¸ê®Æ¤@</Option>
  3. <Option Value=¡¨¸ê®Æ¤G¡¨>¸ê®Æ¤G</Option>
  4. ¡K
  5. </Select>
½Æ»s¥N½X
­Y¨S¦³¿ï©w¹w³]­È¡A«h¿ï³æ¤ºªº²Ä¤@¶µ¸ê®Æ´N¦¨¬°¹w³]­È¡A­Y±ýóª¨ä¥L¶µ¥Ø¬°¹w³]­È¡A«h¥i¦b<Option>¼ÐÅÒ¤º¥[¤J¡uSelected¡vÄݩʳ]©w¡C

¹Ï5-30  ³æ¿ï¦¡¤U©Ô¿ï³æ¡C
select.php(¸`¿ý)
  1. <form action="select_ans.php" method="Post">
  2. ½Ð¿ï¾Ü±z±Mªøªº¹q¸£»y¨¥:<Br>
  3. <Select name="language">
  4. <Option Value="VB">VB</Option>
  5. <Option Value="Delphi" Selected>Delphi</Option>
  6. <Option Value="C++">C++</Option>
  7. <Option Value="PHP">PHP</Option>
  8. <Option Value="Java">Java</Option>
  9. </Select>
  10. <input type="Submit">
  11. </form>
½Æ»s¥N½X
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

·í¦P®É¿ï¨ú¦h­Ó¸ê®Æ¶µ¥Ø®É¡A¨C­Ó¸ê®Æ¶µ¥Ø¦p¦P®Ö¨ú«ö¶s¤@¯ë¡G³£¬O°}¦C¤¸¯À¡A§Ú­Ì¥i¥H§Q¥Îfor°j°é©Î¡ujoin()¡v¨ç¼Æ¡B¡uimplode()¡v¨ç¼Æ¨Ó¦CÁ|¶µ¥Ø¸ê®Æ¡G
¦b¤U¦C½d¨Ò¤¤¤À§O¨Ï¥Î¡ujoin()¡v¨ç¼Æ»P¡uimplode()¡v¨ç¼Æ¨Ó³B²z¸ê®Æ¡G
select_ans_2.php
  1. <html><head>
  2. <title>¤U©Ô¦¡¿ï³æ¤¸¥ó¨Ï¥Î</title>
  3. </head><body>
  4. <?
  5. $mylanguage=$_REQUEST["language"];
  6. ?>
  7. ±zªº¿ï¾Ü(implode()¨ç¼Æ):<Br>
  8. <?
  9. echo implode(">>",$mylanguage);
  10. ?>
  11. <P>
  12. ±zªº¿ï¾Ü(join()¨ç¼Æ):<Br>
  13. <?
  14. echo join("-->",$mylanguage);
  15. ?>
  16. </body></html>
½Æ»s¥N½X

¹Ï5-32  ½Æ¿ï¦¡¤U©Ô¿ï³æ¸ê®Æ³B²z½d¨Ò¡C
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

TOP

¥Ñ©ó¥Ø«e½d¨Ò¬°³æ¿ï¦¡ªº¤U©Ô¿ï³æ¡A©Ò¥HŪ¨úªºÄæ¦ì¨Ã¤£»Ý­n¯S§O³B²z¡G
select_ans.php
  1. <html><head>
  2. <title>¤U©Ô¦¡¿ï³æ¤¸¥ó¨Ï¥Î</title>
  3. </head><body>
  4. <?
  5. $mylanguage=$_REQUEST["language"];
  6. ?>
  7. ±zªº¿ï¾Ü:<?=$mylanguage?>
  8. </body></html>
½Æ»s¥N½X
­Y­n±N¤U©Ô¦¡¿ï³æ³]¬°¦h¶µ¥Ø½Æ¿ï¡A¥i¦b<Select>¼ÐÅÒ¤¤¥[¤J¡umultiple¡vÄݩʳ]©w¡F¹w³]¤U©Ô¿ï³æ¥u·|¥X²{¤@­Ó¸ê®Æ¶µ¥Ø¡]°ª«×¬°1¡^¡A­nÅý¿ï³æ¤¤¥X²{¦h­Ó¸ê®Æ¶µ¥Ø¥i³z¹L¡uSize¡vÄÝ©Ê¥[¥H³]©w¡A¦Ó¥B¤U©Ô¿ï³æ¤¸¥óªºÃѧO¦W¤]À³¸Ó­n§â¥¦§ï¦¨°}¦C§Î¦¡¡G

¹Ï5-31  ½Æ¿ï¦¡¤U©Ô¿ï³æ½d¨Ò¡C
select_2.php(¸`¿ý)
  1. <form action="select_ans_2.php" method="Post">
  2. ½Ð¿ï¾Ü±z±Mªøªº¹q¸£»y¨¥:<Br>
  3. <Select name="language[]" multiple Size=5>
  4. <Option Value="VB">VB</Option>
  5. <Option Value="Delphi">Delphi</Option>
  6. <Option Value="C++">C++</Option>
  7. <Option Value="PHP">PHP</Option>
  8. <Option Value="Java">Java</Option>
  9. </Select>
  10. <input type="Submit">
  11. </form>
½Æ»s¥N½X
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

TOP

        ÀR«ä¦Û¦b : ¡i®É¶¡¦¨´N¤@¤Á¡j®É¶¡¥i¥H³y´N¤H®æ¡A¥i¥H¦¨´N¨Æ·~¡A¤]¥i¥HÀx¿n¥\¼w¡C
ªð¦^¦Cªí ¤W¤@¥DÃD