I am trying to submit a parameter using JavaScript on click event on a li item, inside a foreach loop,
the answers are pulled out of the database and each answer have an id, I want to write the JavaScript code to redirect to another PHP page carrying the parameter, which I pull out with GET,
I pasted the code below for the foreach and the JavaScript function is called clickFunc(),
foreach ($questions_answers_list as $questionID ) {
$questionID = $questions_answers_list[$answerCount]['questionID'];
if ($questionID !== "$quesID") {
$answerCount++;
continue;
} else {
?>
<li class="answersList" onclick="clickFunc()">
<?php echo $questions_answers_list[$answerCount]['answerArabic']; ?>
</li>
<?php
$answerCount++;
}
break;
}
Thanks in advance!