"; // One line per question, separated by ':'. Generate each question // as a line in a table. $qno = 1; // Question numbers. while(! feof($surdef)) { // Get the line and split it into parts. $line = fgets($surdef, 1024); $parts = explode(':', $line); // Generate the question. $ques = htmlspecialchars(array_shift($parts)); echo ""; // Generate the response alternative counts. $rno = 1; echo "\n"; ++$qno; } dba_close($dbm); fclose($surdef); // Close the HTML stuff. echo "
$ques"; foreach($parts as $resp) { $resp = htmlspecialchars($resp); $resp = preg_replace('/ /', ' ', $resp); if($rno > 1) echo "    \n"; $key = "$surid+$qno+$rno"; if(dba_exists($key, $dbm)) $count = dba_fetch($key, $dbm); else $count = 0; echo "$resp: $count"; ++$rno; } echo "
\n"; ?>