Here is my code:
<?php include("include/session.php"); ?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style-comunity.css">
</head>
<title></title>
<body>
<form name="top" action="process.php" method="POST">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td colspan="6" width="100%" bgcolor="#000000" ><img src="top.jpg" width="1000" height="154"></td>
</tr>
<tr align="right" bgcolor="#000000">
<?
if($session->logged_in){
echo"<td width='46%'></td>
<td class='whitetext' width='19%'>Welcome back <b>$session->username</b>, you are logged in.</td>
<td width='10%'></td>
<td width='23%'></td>";
}
else{
?>
<td width="42%"></td>
<td class='whitetext' width="10%">user: <input class="login" type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>"> </td>
<td class='whitetext' width="10%">pass: <input class="login" type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>"></td>
<td class='whitetext' width="3%"><input class="submitLink" type="submit" value="Login"><input class="login" type="hidden" name="sublogin" value="1"></td>
<td width="10%"><? echo $form->error("pass"); ?></td>
<td width="13%"></td>
</tr>
</table>
</form>
<?
}
include("menu.php");
?>
<table>
<tr><td>
<table>
<form name="forum" method="post">
<tr><td class='bluetext' width="75">Indtast navn:</td><td class="noborder"><input class='input' readonly="1" type="text" name="navn" value="<? echo"$session->username"?>"><br></td></tr>
<tr><td class='bluetext'>Indtast emne: </td><td class="noborder"><input class='input' type="text" name="emne"><br></td></tr>
<tr><td valign="top" class='bluetext'>Indtast post: </td><td class="noborder"><textarea class='input' name="post" rows="7" cols="24"></textarea><br></td></tr>
<tr><td class="noborder"></td><td class="noborder"><input type="submit" class="submitLink" value="Post indlæg"> <input type="reset" class="submitLink" value="Slet felter"></td></tr>
</form>
</table>
<br>
<table>
<?php
if(isset($_POST['navn']))
{
$dato = date('d/m/Y H:i:s');
$navn = $_POST['navn'];
$emne = $_POST['emne'];
$post = $_POST['post'];
mysql_query ("INSERT INTO gbog (`id`, `navn`, `emne`, `post`, `dato`) VALUES ('', '$navn', '$emne', '$post', '$dato')") or die(mysql_error());
mysql_query ("FLUSH PRIVILEGES") or die(mysql_error());
}
$foresp = mysql_query("SELECT * FROM gbog ORDER BY id DESC") or die(mysql_error());
;
while($row = mysql_fetch_array($foresp)) {
echo
"<br><tr>
<td class='emne' width='400'>".$row['emne']."</td>
<td class='dato' align='right' width='100'>".$row['dato']."</td>
</tr>
<tr>
<td class='post' colspan='2'>".$row['post']."</td>
</tr>
<tr><td class='bluetext' colspan='2' align='right'>".$row['navn']."</td></tr>
<tr><td class='noborder' colspan='2'></td</tr>";
}
?>
</table>
</tr></td>
</table
</body>
</html>
It all works fine and everything if i delete the top "login" form thingy. But when I add it to the script as here, it comes with a fault and goes back to my main.php. Why is this? Is it because there is two forms or ?
thankS