Advertisement
Guest User

Untitled

a guest
May 20th, 2022
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.59 KB | None | 0 0
  1. <?php
  2. session_start();
  3. $con = mysqli_connect("localhost","root","","test");
  4.  
  5. if(isset($_POST['save_checkbox']))
  6. {
  7.     $name = $_POST['name'];
  8.     $agree = $_POST['agree'];
  9.     $liked = $_POST['liked'];
  10.  
  11.     $query = "INSERT INTO demo (name,agree,liked) VALUES ('$name','$agree', '$liked')";
  12.     $query_run = mysqli_query($con, $query);
  13.    
  14.     if($query_run)
  15.     {
  16.         $_SESSION['status'] = "Inserted Successfully";
  17.         header("Location: index.php");
  18.     }
  19.     else
  20.     {
  21.         $_SESSION['status'] = "Not Inserted";
  22.         header("Location: index.php");
  23.     }
  24. }
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement