
ghecko1
Deleted
Mar 12, 2001, 4:18 PM
Post #3 of 4
(401 views)
|
Re: Creating HTML from a script
[In reply to]
|
Can't Post
|
|
Hi thanks for the tips... OK I have now got a page with the table and the word "working" in the middle...the next step is to take the following code which gathers and creates the questions on the page within the table instead of the word "working". print "<center><form action=\"$url\" method=\"post\">\n"; open(CHOICES, $data_choices); @choices = <CHOICES>; close(CHOICES); open(QUES, $data_questions); @questions = <QUES>; close(QUES); for ($i=0; $i<$num_display; $i++) { $sequence[$i] = -1; } for ($i=0; $i<$num_display; $i++) { do { $sequence[$i] = int(rand($num_questions)); $repeated = 0; for ($j=0; $j<$num_display; $j++) { if ($sequence[$i] == $sequence[$j] && $i != $j) { $repeated = 1; } } } while ($repeated == 1); } for ($i=0; $i<$num_display; $i++) { print "<font face=\"verdana,geneva,arial\" size=2><b>"; print ($i+1); chomp($questions[$sequence[$i]]); print ". $questions[$sequence[$i]]</b></font> \n"; chomp($choices[$sequence[$i]]); print "<font face=\"verdana,geneva,arial\" size=2>"; if ($choices[$sequence[$i]] ne "") { @temps = split(/\|/, $choices[$sequence[$i]]); foreach $temp (@temps) { print "<input type=\"radio\" name=\"$sequence[$i]\" value=\"$temp\">$temp "; } } else { print "Answer: <input type=\"text\" name=\"$sequence[$i]\" size=30>"; } print "</font>\n"; print "<p>\n"; } print "<font face=\"verdana,geneva,arial\" size=2>"; print "Please enter your alias: "; print (defined($name)? "<input type=\"text\" name=\"name\" value=\"$name\"> \n": "<input type=\"text\" name=\"name\"> \n"); print "Please enter your E-mail: "; print (defined($email)? "<input type=\"text\" name=\"email\" value=\"$email\">": "<input type=\"text\" name=\"email\">"); print "</font>\n<p>\n"; $" = "\|"; print <<END_OF_HTML; <input type="hidden" name="action" value="submit"> <input type="hidden" name="number" value="$num_display"> <input type="hidden" name="sequence" value="@sequence"> <input type="submit" value="Grade Online Exam"> </form> Phew....thanks again for any light you chaps can shed on this..its graetly appreciated.
|