a red box indicating a wrong answer

Hi everybody

I am creating a quiz. On the question page, students see a picture (for example a box) they have to descrive the shape of. They can select the answer from a menu called SHAPE and they can chooce between the answer “round” and “ square”. After clicking on the “check my answer” button, they answer the student gave is compared with the answer I put in the database. So far no problems. But I have no idea how to program the next part:
If the answer is wrong (for example picture 1 is a round box and the student answers with square, than after clicking on the “check my answer” button, he will be transferred back to the question page but this time a red box is around the SHAPE menu, indicating that this answer is wrong.
–> does anyone know how to do this?

(I added a picture that shows the database flowchart. Questions is the name of the database. Subheads are picture 1 to 3. And every picture subhead has the same subsubheads. )

This is the part on the question page:

[code]<?php
$array_shape = Array(“round”,“square”);  these are the answers student scan choose between
?>

vorm
SHAPE <?php echo implode("",$array_shape); ?>
 this part creates a menu with the title SHAPE and 2 answers students can chooce from: round or square  this part adds a “check my answer” button. [/code]

This is the part on the result page:

[code]<?php
error_reporting ( E_ALL | E_STRICT );
ini_set ( ‘display_errors’, 1 );
?>

<?php include 'connect.php'; ?> <?php $wronganswer = "The answer is incorrect." $noanswer = "You did not gave an answer. " $answer = "Answer: "; $shapeeggo = "Shape: "; $array_shape = Array("round","square"); if($_SERVER['REQUEST_METHOD'] == 'POST' ) { $query = "select * from foto1 where "; $query_init = $query; $first_option = true; if (isset($_POST["form_vorm"])){ if ($first_option == false){ $query .= " AND "; } else{ $first_option = false; } $query .= "("; for ($i=0; $i<=count($_POST["form_shape"])-1; $i++){ if ($i == 0){ $query .= "(shape LIKE '%".$_POST["form_shape"][$i]."%') "; }else{ $query .= " OR (shape LIKE '%".$_POST["form_shape"][$i]."%') "; }} $query .= ")"; } if ($query == $query_init){ echo "
" . $noanswer . "
"; }else{ //echo $query."

"; if ($result = mysql_query($query)) { if (mysql_num_rows($result)<>0) { while ( $row = mysql_fetch_assoc ( $result ) ) { echo "
" . $answer. "
"; echo "
" . $shapeggo . $row["SHAPE"]. "
"; "; $answerquery = "select ANSWER from answer where Catalog_ID=".$row["ID"]; if ($answerresult = mysql_query($answerquery)) { if (mysql_num_rows($beschrijvingresult)<>0) { while ( $answerrow = mysql_fetch_assoc ( $answerresult ) ) { echo "
" . $diagnose . "
"; echo "
" . $answerrow["ANSWER"]."
"; } } else { echo "no answer given
"; }} ?>

[/code]

Sponsor our Newsletter | Privacy Policy | Terms of Service