During a while loop in PHP I want to create following link:
echo '<a onclick="getSolution('.ResultArray['qid'].')" style="color: red;">Lösung anzeigen</a>';
But there it is a mistake. It will not take the $ResultArray['qid'] as a parameter for the javascript function. I need this parameter for define which div it has to take when clicking on the link.
Here you get the complete while loop in php:
while($ResultArray = mysqli_fetch_array($getQuestions)) {
echo '<p>';
echo $ResultArray['question'];
echo '<br />';
echo '<input type="text" style="width: 500px;"/>';
echo '</p>';
echo '<a onclick="getSolution('.ResultArray['qid'].')" style="color: red;">Lösung anzeigen</a>';
echo '<div id="'.$ResultArray['qid'].'" style="visibility: hidden">';
echo $ResultArray['answer'];
echo '</div>';
}
How I can fix this problem?