作者jjdai (阿厝)
看板PHP
标题Re: [请益]下拉式选单的问题
时间Sat Sep 25 18:26:39 2010
※ 引述《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