我有一些正常工作的PHP代碼。不過,我想輸出Dropdownlist到我的TPL文件。我怎樣才能做到這一點?輸出Dropdowlist到TPL文件
<?php
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$sql="SELECT * FROM $tbl_name ORDER BY SORT_ORDER ASC";
$result=mysql_query($sql);
if ($result === false) { echo "An error occurred."; }
?>
<html>
<head>
<title></title>
</head>
<body>
<select name="usrname" id="usrname">
<option>Select employ</option>
<?php
while($rows=mysql_fetch_array($result)){
?>
<option value="<? echo $rows['ID']; ?>"><? echo $rows['TITLE']; ?></option>
<?php
}
mysql_close();
?>
</select>
</body>
</html>
這不是我的意思。我想我需要分配它: $ tpl - >分配 我想從.tpl拉起它而不是PHP。 – user2063873 2013-03-09 07:19:27