I have a parse error in my php code
Posted
by
user1421767
on Stack Overflow
See other posts from Stack Overflow
or by user1421767
Published on 2012-06-01T22:24:24Z
Indexed on
2012/06/01
22:40 UTC
Read the original article
Hit count: 147
php
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;
?>
© Stack Overflow or respective owner