Skip to content

Instantly share code, notes, and snippets.

@ajhodges
Created April 24, 2014 04:43
Show Gist options
  • Save ajhodges/11241768 to your computer and use it in GitHub Desktop.
Save ajhodges/11241768 to your computer and use it in GitHub Desktop.
<?php
if(isset($_GET["blah"])){
//check if correct
if($taxonguess == "taxon"){
$correct = true;
} else {
$correct = false;
}
}
if(!isset($_GET["blah"]) || $correct){
//generate new answer stuff
$dino_img = $link_to_new_dino_img;
$dino_taxon = $new_dinos_taxon;
} else {
$dino_img = $link_to_old_dino_img;
$dino_taxon = $old_dinos_taxon;
}
?>
<html>
<body>
<?php if(isset($correct)): ?>
<div class="alert alert-<?php echo $correct ? "success" : "danger"; ?> container">
<?php if($correct): ?>
<strong>Well done!</strong> You successfully answered this question!
<?php else: ?>
<strong>Oops!</strong> Check your spelling and try submitting again.
<?php endif;?>
</div>
<?php endif; ?>
<img src="<?php echo $dino_img; ?>"/>
...etc, put <?php echo $dino_taxon; ?> in the hidden input
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment