Re: [請益]下拉式選單的問題

看板PHP作者 (阿厝)時間13年前 (2010/09/25 18:26), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
※ 引述《Jahn (Somson)》之銘言: : 請問各位成是高手 : 我有一個網頁中有很多項目,如果我想做一個下拉式選單來選擇我想要找尋的項目。 : 使用PHP程式碼該如何撰寫。 : 謝謝 PHP中的迷途初學者@@ Smarty 解法 :Q (Copy from Smarty Manual) PHP 程式: <?php $smarty->assign('cust_ids', array(1000,1001,1002,1003)); $smarty->assign('cust_names', array( 'Joe Schmoe', 'Jack Smith', 'Jane Johnson', 'Charlie Brown')); $smarty->assign('customer_id', 1001); ?> Template: <select name="customer_id"> {html_options values=$cust_ids output=$cust_names selected=$customer_id} </select> -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.64.48.105
文章代碼(AID): #1CdSvYwV (PHP)
文章代碼(AID): #1CdSvYwV (PHP)