For the life of me I cannot see what is wrong with this page, can someone help me out. I add a message and it refreshes the page but the information is not added to the database :blink: no error, nothing.
<?
require_once("../header.php");
require_once("../config.php");
require_once("../functions.php");
// Prep database
if ($GLOBALS["persist"])
$db = @mysql_pconnect($dbhost, $dbuser, $dbpass) or showError("Tracker error: can't connect to database. Contact the webmaster.");
else
$db = @mysql_connect($dbhost, $dbuser, $dbpass) or showError("Tracker error: can't connect to database. Contact the webmaster.");
@mysql_select_db($database) or showError("Tracker error: can't open database. Contact the webmaster");
?>
<br />
<FORM ACTION="<?php echo($PHP_SELF); ?>" METHOD=POST>
<P>Type your post here:<BR>
<TEXTAREA NAME="newtext" ROWS=10 COLS=40 WRAP>
</TEXTAREA><BR>
<INPUT TYPE=SUBMIT NAME="submitpost" VALUE="SUBMIT">
</FORM>
<?
if (! @mysql_select_db($database) ) {
echo( "<P>Unable to locate the" .
"database at this time.</P>" );
exit();
}
// If a post has been submitted,
// add it to the database.
if ("SUBMIT" == $submitpost) {
$sql = "INSERT INTO posts SET " .
"posttext='$newtext', " .
"postdate=CURDATE()";
if (mysql_query($sql)) {
echo("<P>Your post has been added.</P>");
} else {
echo("<P>Error adding submitted post: " .
mysql_error() . "</P>");
}
}
?>
<?
require_once("../footer.php");
?>
I know the code is a little dissjointed but its nowhere near finished and I am still trying to get the simple functions working before I tart it up 😉