我想知道是否有人能夠幫助我。單選按鈕列表
我正在使用下面的代碼構造一個單選按鈕作爲選擇每一行數據的方式。
<?php
mysql_connect("hostname", "username", "password")or
die(mysql_error());
mysql_select_db("database");
$result = mysql_query("SELECT userdetails.userid, finds.userid, finds.locationid, detectinglocations.locationid, detectinglocations.locationname, finds.dateoftrip, finds.findname, finds.finddescription FROM userdetails, finds, detectinglocations WHERE finds.userid=userdetails.userid AND finds.locationid=detectinglocations.locationid AND finds.userid = 1");
if (mysql_num_rows($result) == 0)
// table is empty
echo 'There are currently no finds recorded for this location.';
echo"<table>\n";
while (list($userid, $dateoftrip) =
mysql_fetch_row($result))
{
echo"<tr>\n"
.
"<td><input type='radio' name='radio' dateoftrip, value='{$userid}' /></td>\n"
."<td><small>{$dateoftrip}</small><td>\n"
."</tr>\n";
}
echo"<tr><td colspan=\"3\">";
echo"<br>";
echo"</td></tr>";
echo'</table>';
?>
我可以管理來構建列表中,但旁邊的單選按鈕的值是「用戶ID」,而我期待把「dateoftrip」對每個單選按鈕。
我一直在這個工作了一段時間,我看不到我的錯誤在哪裏。
我只是想知道是否有人可以看看這個請讓我知道我要去哪裏錯了。
非常感謝
你好,非常感謝你幫我完成這個。不勝感激。 – IRHM 2012-02-22 14:17:34