First you're asking for trouble if you allow form data to be inserted straight into your db:
$user = $id;
$datestamp = date("YmdHis");
$comments = $_POST['frm_comments'];
$comments = stripslashes($comments);
$insert_comments = "Insert into tbl_comments (user, datestamp, article_id, comments) VALUES('$user', '$datestamp', '$article_id', '$comments')";
$result1 = mysql_query($insert_comments);
look up mysql_real_escape_string .
and you may want to check for magic_quotes before you use stripslashes: http://uk.php.net/manual/en/function.get-magic-quotes-gpc.php (otherwise you could get into trouble if you ever switch servers or your php.ini changes).
Second, this code:
$userid = "SELECT id FROM tbl_users where username = '$username'";
$select_user_id = mysql_query($userid);
while ($row = mysql_fetch_assoc($select_user_id))
{
foreach ($row as $field=>$value)
{
if ($field==id)
$id = $value;
}
}
$user = $id;
can surely be reduced to just
$userid = "SELECT id FROM tbl_users where username = '$username'";
$select_user_id = mysql_query($userid);
$row = mysql_fetch_assoc($select_user_id);
$user = intval($row['id']);
unless i'm much mistaken!
Finally, in answer to your question, one way to do it is to use the header function in PHP to redirect back to the same page once you have inserted the data into the db. Watch out though as you need to make sure nothing has been sent to the browser before you use a header redirect.