I've got this code:
<?php
session_start();
if (!$_SESSION["valid_user"])
{
// User not logged in, redirect to login page
Header("Location: login.php");
}
include ("dbConfig.php");
?>
<?php
if ($submit) {
$sql = "INSERT INTO threads (userid,postid,title,text,date) VALUES ('$userid','$postid','$title','$text','$date')";
$result = mysql_query($sql);
echo "Thank you! Your message has been posted.\n";
} else{
?>
<form method="post" name="inputform" action="<?php echo $PHP_SELF?>">
<input type="hidden" name="postid" value="<?php print $id; ?>">
<input type="hidden" name="date" value="<?php echo date("y.m.d, H:i:s",time()); ?>">
<input type="hidden" name="userid" value="<?php print $_SESSION["valid_id"]; ?>">
Title: <input type="text" size="37" name="title">
<br><textarea rows="10" name="text" cols="40"></textarea><br><br>
<input type="Submit" name="submit" value="Post Message">
</form>
<?php
} // end if
?>
But as well as entering the data into a new record, I want to update another record with the same date information.
Can anyone point me in the right direction please?
Thanks in advance.