<? # original code Jayesh Jain, amends by me, still needs form input validation, etc
include("connect.php"); # Your connection details
$submit = $_POST[submit];
if(isset($submit)) // check if submitted button is clicked
{
// insert the record in the database
$sql = "INSERT INTO forum (parentcode,title,description,uname,email) VALUES ('$_POST[node]','$_POST[title]','$_POST[description]','$_POST[postname]','$_POST[email]')";
#echo "<br>".$sql."<br>";
$result = mysql_query($sql);
header("location:forum.php"); // open forum.php file to display the thread
}
?>
<CENTER>Post to Discussion Forum using PHP/<s>Access</s> MySql under <s>IIS</s> Apache</CENTER>
<?
$node = $_GET[node];
if ( $node != 0 ){
// Displaying the details of the thread
echo "<HR>";
$sql = "SELECT code, title, uname, email FROM forum WHERE code = '$node'";
#echo "<br>".$sql."<br>";
$result = mysql_query($sql);
list($code,$title,$uname,$email) = mysql_fetch_row($result);?>
<?=$title?> by (<?=$uname?>

<?$email?><BR>
<?=$description?>
<BR>
<HR>
<?}?>
<!-- Form to enter the message -->
<FORM method='post' action='node.php'>
Name : <INPUT TYPE=TEXT NAME=postname> <BR>
E-Mail : <INPUT TYPE=TEXT NAME=email> <BR>
Title : <INPUT TYPE=TEXT NAME=title VALUE = '' size=50> <BR>
Description : <BR> <TEXTAREA name=description rows=10 cols=45></TEXTAREA>
<!-- we need a hidden field to store the node -->
<INPUT TYPE=hidden NAME=node value='<? echo $_GET[node];?>'> <BR>
<INPUT type=submit name=submit value='Post Message'>
</FORM>