Don't like ads? PRO users don't see any ads ;-)
Guest

Php form

By: a guest on May 7th, 2012  |  syntax: PHP  |  size: 1.24 KB  |  hits: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.       <?php        
  2.                                            
  3.                  if (isset($_POST['submit'])) {      
  4.                                                  
  5.                       $comment_body = mysql_real_escape_string($_POST['comment_body']);
  6.                      
  7.                       if (($comment_body == "") || ( strlen($comment_body) > 250)) {
  8.                        echo "<div class=\"error\" >" ;  
  9.                        echo "One/More enteries Of The form is empty";
  10.                        echo "</div>";  
  11.                    
  12.                       } else {
  13.                                    
  14.                                                        
  15.                                      
  16.               $query = "INSERT INTO comment (comment_id, article_id, username, page_name, comment_body, comment_date)  
  17.                                   VALUES (NULL, '".$article_id."', '".$_SESSION['logged_username']."',  '".$page_name."', '".$comment_body."', NOW())";
  18.                         mysql_query($query) or die (mysql_error());          
  19.                              
  20.                              
  21.                       }  
  22.                      
  23.                  }
  24.                          
  25.                  ?>