Jump to content

VanKaizer

Members
  • Posts

    1
  • Joined

  • Last visited

VanKaizer's Achievements

Newbie

Newbie (1/7)

1

Reputation

  1. I have just started to learn PHP and Javascript in the past week. I often find it best to learn these things through actually working on a small project and trial/error. To begin my learning process I have set out creating an exam that has more than one value as the correct answer. Here is the code for the question itself: What devices are available to borrow?<form action="answer.php" method="POST"><br /><input type="text" maxlength="22" name="key" /><input type="hidden" name="correctkey" value="laptop" /><input type="hidden" name="page" value="question1.PHP" /><input type="hidden" name="nextpage" value="question2.PHP" /></form> Here is what is looks like server side: <? ob_start(); ?><html><?php$key = $_POST['key'];$correctkey = $_POST['correctkey'];$page = $_POST['page'];$nextpage = $_POST['nextpage'];if ($key==$correctkey) header("Location: $nextpage");else header("Location: $page");?></html><? ob_flush(); ?> In this case "laptop" is a correct answer, but I want to make it so more than one item could be considered correct. Help a noob coder out. Thanks guys!
×
×
  • Create New...