我有一段代碼,我正在努力。我想的onclick功能,以顯示功能的「問題」行,但是當我把'$questionrow['QuestionContent']'
括號內,它給我的錯誤,指出:我在我的PHP代碼中有一個解析錯誤
解析錯誤:語法錯誤,意想不到的T_ENCAPSED_AND_WHITESPACE,期待T_STRING或T_VARIABLE或T_NUM_STRING在/xxx7/Mobile_app/previousquestions.php 119線上
如何放置QuestionContent括號內正確如下功能:
onclick='parent.addwindow('$questionrow['QuestionContent']');'>Add</button>
下面是整個代碼:
<?php
$output = "";
while ($questionrow = mysql_fetch_assoc($questionresult)) {
$output .= "
<table>
<tr>
<td class='questiontd'>{$questionrow['QuestionContent']}</td>
<td class='addtd'><button type='button' class='add' onclick='parent.addwindow('$questionrow['QuestionContent']');'>Add</button></td>
</tr>";
}
$output .= " </table>";
echo $output;
?>
當我嘗試你的代碼,現在規定我有一個語法錯誤的螢火,說明我有一個缺少「)」,但我沒有看到丟失的支架。爲什麼會出現這種錯誤 – user1394925
嘗試<按鈕類型= '按鈕' 類= '添加' 的onclick = 「parent.addwindow( '{$ questionrow [' QuestionContent ']}');」>添加 ......注意「爲的onclick –
它現在給我這個錯誤,當我嘗試你的理論:'解析錯誤:語法錯誤,在/web/stud/xxx/Mobile_app/previousquestions.php意外T_STRING上線119' – user1394925