我有一個PHP開關盒。如何使用按鈕點擊「n」的值?設置PHP開關盒的值
switch (n)
{
case 1:
$result = mysql_query("select * from tblRestaurants order by RestName ASC");
break;
case 2:
$result = mysql_query("select * from tblCuisines order by RestName ASC");
break;
case 3:
$result = mysql_query("select * from tblLocations order by RestName ASC");
break;
case 4:
$result = mysql_query("select * from tblLocations order by RestName ASC");
break;
case 5:
$result = mysql_query("select * from tblLocations order by RestName ASC");
break;
}
onclick = (switch)n=1
只是猜測
onclick是一個JavaScript函數嘗試重新簽署您的問題 –
您不需要。 PHP是一種_preprocessor_語言,用於生成由瀏覽器執行的HTML和Javascript。你試圖錯誤地使用它。 –
看來你正試圖調用一個JavaScript函數,只能使用適量的獨角獸眼淚灑在頂部。 – Jason