Advertisement
rofelbca

user

Jul 25th, 2024 (edited)
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 2.46 KB | Source Code | 0 0
  1. <?php
  2.     $con= new mysqli('localhost','root','','crudop');
  3.     if(isset($_POST['submit'])){
  4.         $visitors=$_POST['visitors'];
  5.         $contact=$_POST['contact'];
  6.         $purpose=$_POST['purpose'];
  7.        
  8.        
  9.  
  10.       //insert query
  11.       $sql = "INSERT INTO company( visitors, contact, purpose)
  12.      VALUES( '$visitors', '$contact','$purpose' )";
  13.  
  14.       //execute query
  15.       $result=mysqli_query($con,$sql);
  16.  
  17.       // we will check
  18.       if($result) {
  19.         echo "data inserted successfully";
  20.         header('Location:display.php');
  21.           }else{
  22.             die(mysqli_error($con));
  23.           }
  24.         }
  25. ?>
  26. <!doctype html>
  27. <html lang="en">
  28.   <head>
  29.     <!-- Required meta tags -->
  30.     <meta charset="utf-8">
  31.     <meta name="viewport" content="width=device-width, initial-scale=1">
  32.  
  33.     <!-- Bootstrap CSS -->
  34.     <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
  35.  
  36.     <title>php crud</title>
  37.   </head>
  38.   <body>
  39.     <div class="container">
  40.         <form method="post">
  41.   <div class="mb-3">
  42.     <label> VISITORS_NAME </label>
  43.     <input type="text" class="form-control" name="visitors" >
  44.   </div>
  45.   <div class="mb-3">
  46.     <label> CONTACT</label>
  47.     <input type="email" class="form-control" name="contact">
  48.   </div>
  49.   <div class="mb-3">
  50.     <label> PURPOSE</label>
  51.     <input type="text" class="form-control" name="purpose ">
  52.   </div>
  53.  
  54.  
  55.   <button type="submit" class="btn btn-primary" name="submit">Submit</button>
  56. </form>
  57. </div>
  58.  
  59.     <!-- Optional JavaScript; choose one of the two! -->
  60.  
  61.     <!-- Option 1: Bootstrap Bundle with Popper -->
  62.     <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
  63.  
  64.     <!-- Option 2: Separate Popper and Bootstrap JS -->
  65.     <!--
  66.     <script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
  67.     <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF" crossorigin="anonymous"></script>
  68.     -->
  69.   </body>
  70.   </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement