<?
include "./auth.inc.php";
if (!$ID){
header ("Location: faq.php");
exit;
}
if ($text){
#add to database and exit
$isql="INSERT INTO Answers(QuestionID, Answer, Answerer, Atime)
VALUES($ID,'$text','$PHP_AUTH_USER',now())";
mysql_query($isql);
$usql="UPDATE Questions SET Answer=LAST_INSERT_ID() WHERE QuestionID=$ID";
mysql_query($usql);
print "You have just shortened someone's path to enlightenment.";
print '<P><a href="faq.php">Back to the FAQ</A>';
exit;
}
$sql="SELECT Question FROM Questions WHERE QuestionID=$ID";
$res=mysql_query($sql);
$row=mysql_fetch_row($res);
?>
<FORM>
Answer the Question!
<BR>
<FONT FACE=Arial COLOR=RED><? echo $row[0] ?></FONT><BR>
<TEXTAREA cols=50 rows=12 NAME=text></TEXTAREA><BR>
<INPUT TYPE=HIDDEN NAME=ID VALUE="<? echo $ID ?>">
<INPUT TYPE=SUBMIT>
</FORM>