
Php form
By: a guest on
May 7th, 2012 | syntax:
PHP | size: 1.24 KB | hits: 18 | expires: Never
<?php
if (isset($_POST['submit'])) {
$comment_body = mysql_real_escape_string($_POST['comment_body']);
if (($comment_body == "") || ( strlen($comment_body) > 250)) {
echo "<div class=\"error\" >" ;
echo "One/More enteries Of The form is empty";
echo "</div>";
} else {
$query = "INSERT INTO comment (comment_id, article_id, username, page_name, comment_body, comment_date)
VALUES (NULL, '".$article_id."', '".$_SESSION['logged_username']."', '".$page_name."', '".$comment_body."', NOW())";
mysql_query($query) or die (mysql_error());
}
}
?>