daily pastebin goal
45%
SHARE
TWEET

Untitled

a guest Dec 6th, 2016 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $servername = "localhost";
  3. $username = "root";
  4. $password = "";
  5. $dbname = "contactsDB";
  6.  
  7. $fname = $_POST['fname'];
  8. $sname = $_POST['sname'];
  9. $email = $_POST['email'];
  10. $cat = $_POST['cat'];
  11.  
  12. // Create connection
  13. $conn = new mysqli($servername, $username, $password, $dbname);
  14. // Check connection
  15. if ($conn->connect_error) {
  16.     die("Connection failed: " . $conn->connect_error);
  17. }
  18.  
  19. $sql = "Insert into contactsTbl(fname, sname, email, cat) values('$fname', '$sname', '$email', '$cat')";
  20. //echo $sql;
  21. $result = $conn->query($sql);
  22.  
  23. $conn->close();
  24. header("location:http://localhost:8080/contacts/all.php");
  25. die();
  26. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top