Jump to content

alexduff

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

alexduff's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I saw those 'hidden fields' CV and wondered what they were - I'll play about with these. Thanks for the pointer! Alex.
  2. Sorry, JonsJava. <html> <head> <title></title> </head> <body> <?php echo' <table width="560" border="0" cellspacing="0" cellpadding="0">'; $answer = array(); // $question_type = array();// I know I'd have been better with a 2D array here. $question_s = array(); $question_d = array(); $question_th = array(); $question_tm = array(); $cntr = 0; $nos = 10; for ($i = 0; $i < $nos; $i++) { // There are 10 questions $type = rand(1,1); // Questions are SDT. To simplify, ony posted code for Distance. if ($type == 1) { $question_type[$i]="distance"; //distance do { $speed = rand(10, 40); do { $timeh = rand(0, 3); $timem = rand(0, 3); } while ($timeh == 0 and $timem == 0); $time = $timeh + ($timem * 0.25); $a = $speed * $time; } while ($a <> intval($a)); // Just ensuring that the calculated distance is an integer value $answer[$i] = $a; $time = ""; if ($timeh == 1) { $time = $timeh . ' hour'; } if ($timeh > 1) { $time = $timeh . ' hours'; } if ($timeh > 0 and $timem > 0) { $time = $time . ' '; } if ($timem > 0) { $timem = $timem * 15; $time = $time . $timem . ' minutes'; } echo '<tr><td width="480" height="20"></p><tr><td width="400" height="20"> '. 'At ' . $speed . ' mph, how far would you travel in '.$time . '? '.'</td>'; // asking the question echo '<td width="160"> <input name="b'.$i.'" type="text" id="b1" size="6" maxlength="3"> miles '.$answer[$i].'</td></tr>'; // form field for the answer } $question_d[$i]=$distance; $question_s[$i]=$speed; $question_th[$i]=$timeh; $question_tm[$i]=$timem; } echo' </table>'; ?>?> </body> </html> I'm trying to find a way of telling the user how many questions they got correct out of 10, and display the original questions and answers. Again, many thanks for any help anyone can give.
  3. I'm attempting to create a page with 10 random questions on it. I've managed to generate and display the questions in a table with form fields for the answers. However, I am finding great difficulty in sending the questions to a page to check the answers. It's easy enough to send the answers, but how do I send the randomly generated data alongside it? Can anyone give me any clues as to how to send local variables from one page to another? Any help would be greatly appreciated!!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.