Guest User

Untitled

a guest
Jan 22nd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //javascript function
  2.  
  3. function submitComment(rowid, comment, event){
  4.                 if(event.keyCode == 13){
  5.                     $.post('../resource/ajax.php', {addcomment:comment, rowId:rowid});3
  6.                     alert('sent')
  7.                 }
  8.              }
  9.  
  10. //html
  11. <button id="deleteComment" name="deleteComment" value="<?php echo $comment['Id']; ?>" onclick="proceed()">X</button>
  12.  
  13.  
  14. //php ajax
  15.  
  16.     if(isset($_POST['addcomment'])){
  17.        
  18.         $comment = $_POST['addcomment'];
  19.         $Dbid = $_POST['rowId'];
  20.         $user = $_SESSION['session_user'];
  21.         $sql = "INSERT INTO Dcomment (Id, Username, Email, Comments, UDate, Dbid)  VALUES ('',  '$user', '', '$comment', CURRENT_TIMESTAMP, '$Dbid')";
  22.  
  23.         $result = mysql_query($sql);
  24.        
  25.     }
Add Comment
Please, Sign In to add comment