Hi all,
I am using a random quiz script that has an admin section for adding questions. I would like to improve this by making it so I can also modify and/or delete questions (plus password protect it
). Here is the code for adding:
$alt_answers .= $data{'alt_answer1'} if $data{'alt_answer1'};
$alt_answers .= "%%$data{'alt_answer2'}" if $data{'alt_answer2'};
$alt_answers .= "%%$data{'alt_answer3'}" if $data{'alt_answer3'};
$alt_answers .= "%%$data{'alt_answer4'}" if $data{'alt_answer4'};
open(FILE, ">>$questionfile") | | print "Could not open question file: $!<br>";
print FILE "$data{'question'}|$data{'answer'}|$alt_answers|\n";
close(FILE);
How do I identify the question(s) I would like to modify or delete? Is it by line number? Tips on how to write the new sections without messing everything up (I've already mastered that aspect, thanks anyway
) would be greatly appreciated.
Thanks,
Dan
I am using a random quiz script that has an admin section for adding questions. I would like to improve this by making it so I can also modify and/or delete questions (plus password protect it
Code:
print "Content-type: text/html\n\n"; $alt_answers .= $data{'alt_answer1'} if $data{'alt_answer1'};
$alt_answers .= "%%$data{'alt_answer2'}" if $data{'alt_answer2'};
$alt_answers .= "%%$data{'alt_answer3'}" if $data{'alt_answer3'};
$alt_answers .= "%%$data{'alt_answer4'}" if $data{'alt_answer4'};
open(FILE, ">>$questionfile") | | print "Could not open question file: $!<br>";
print FILE "$data{'question'}|$data{'answer'}|$alt_answers|\n";
close(FILE);
How do I identify the question(s) I would like to modify or delete? Is it by line number? Tips on how to write the new sections without messing everything up (I've already mastered that aspect, thanks anyway
Thanks,
Dan

