I would store them as a hash. Possibly a nested data structure if I needed more info. This would be good:
%q_and_a = ( '105' => 'How do I use Netscape',
'111' => 'How do I listen to MP3s',
'119' => 'How can I send email with attachments'
);
You can cycle through each question like this:
foreach (keys(%q_and_a)) {
print "Q: <a href=answers.cgi?q=$_>$q_and_a{$_}</a>\n";
}
This is a simple hash, and the keys are the unique identifiers for each question in the database. So when someone clicks on the link, your script would capture the id number and then pull out the answer and display it.
Sample output:
Q: <a href=answers.cgi?q=119>How can I send email with attachments</a>
Q: <a href=answers.cgi?q=111>How do I listen to MP3s</a>
Q: <a href=answers.cgi?q=105>How do I use Netscape</a>
|