我收到這條消息 (語法錯誤,意外的T_STRING,期待','或';') 當我試圖運行下面的代碼:PHP錯誤:「語法錯誤,意外T_STRING,期待','或';'」
<html>
<head>
</head>
<body>
<title>Num One Website</title>
<?
$con = mysql_connect("","","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("", $con);
$result1 = mysql_query("SELECT * FROM Students") ;
echo "<form action='ConfirmEnter.php' method='post'>";
echo "<input type="Radio" name="mark" value="mt">"."MidTerm<br>";
echo "<input type="Radio" name="mark" value="pr">"."Project<br>";
echo "<input type="Radio" name="mark" value="fi">"."Final<br>";
echo "<table border cellpadding=3>";
echo "<tr>";
echo "<th>ID</th>";
echo "<th>MidTerm</th>";
echo "<th>Project</th>";
echo "<th>Final</th>";
echo "<th>Total</th>". "</tr>";
$count=1;
while($row1 = mysql_fetch_array($result1))
{
echo "<tr>";
echo "<td><input name='ID[]' readonly='readonly' value='". $row1['ID'] ."' size=5/></td> ";
echo "<td><input type='text' name='mt[]' size=5 value='0.0' /></td>";
echo "<td><input type='text' name='pr[]' size=5 value='0.0' /></td>";
echo "<td><input type='text' name='fi[]' size=5 value='0.0' /></td>";
echo "</tr>";
$count++;
}
echo "</table>";
echo "<input type='submit' value='Submit' />";
echo "</form>";
mysql_close($con);
?>
</body>
</html>
錯誤在這些行:
echo "<input type="Radio" name="mark" value="mt">"."MidTerm<br>";
echo "<input type="Radio" name="mark" value="pr">"."Project<br>";
echo "<input type="Radio" name="mark" value="fi">"."Final<br>";
我看了你的網站和其他網站的這個問題,但我無法找到它的解決方案。
儘量不要寫全部大寫。這就像大喊大叫。 –
你爲什麼決定對這三行使用雙引號,然後對所有其他行使用單引號? – animuson
您可以使用[HEREDOC](http://php.net/heredoc)來避免整個問題。 –