I have a parse error in my php code
- by user1421767
I have a piece of code which I am struggling on. I want the onclick function to display the "Question" row in the function but when I place '$questionrow['QuestionContent']' within the brackets, it is giving me an error stating:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /xxx7/Mobile_app/previousquestions.php on line 119
How do I place the QuestionContent within the brackets correctly in function below:
onclick='parent.addwindow('$questionrow['QuestionContent']');'>Add</button>
Below is whole code:
<?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;
?>