Re: [請益]下拉式選單的問題
※ 引述《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
討論串 (同標題文章)