Advertisement
Guest User

Untitled

a guest
Aug 18th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.61 KB | None | 0 0
  1. <?php
  2.  
  3. if ($_SERVER['REQUEST_METHOD'] == 'POST'){
  4.    
  5.     $tittle = $_POST['tittle'];
  6.     $note = $_POST['note'];
  7.     $color = $_POST['color'];
  8.  
  9.     require_once("connect.php");
  10.  
  11.     $query = "INSERT INTO `notes` (tittle, note, color) VALUES ('$tittle', '$note', '$color') ";
  12.  
  13.     if ( mysqli_query($conn, $query) ){
  14.        
  15.         $response['success'] = true;
  16.         $response['message'] = "Succesfully";
  17.        
  18.     }else{
  19.        
  20.         $response['success'] = false;
  21.         $response['message'] = "Failure";
  22.        
  23.     }
  24.    
  25. }else{
  26.    
  27.     $response['success'] = false;
  28.     $response['message'] = "Error";
  29.    
  30. }
  31.    
  32. echo json_encode($response);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement