SHARE
TWEET

Untitled

a guest Oct 4th, 2017 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.     $servername = "sql404.byethost4.com";
  3.     $username = "b69_20717911" ;
  4.     $password = "password" ;
  5.     $dbname = "b69_20717911_db" ;
  6.  
  7.     $conn = new mysqli($servername, $username, $password, $dbname) ;
  8.         if ($conn->connect_error) {
  9.             die ("Connection failed: " . $conn->connect_error);
  10.  
  11.     }
  12.     $first_name = $_POST ['first_name'];
  13.     $last_name = $_POST ['last_name'];
  14.     $email = $_POST ['email'];
  15.     $message = $_POST ['message'];
  16.     $ip = $_SERVER ['SERVER_ADDR'];
  17.  
  18.     $sql = "INSERT INTO forms (ip, first_name, last_name, email, message)
  19.     VALUES ('$ip', '$first_name', '$last_name', '$email', '$message')";
  20.     if ($conn->query($sql) === TRUE) {
  21.         echo "New record created succsessfully";
  22.     }   else {
  23.         echo "Error: " . $sql . "<br>" . $conn->error;
  24.     }
  25.  
  26.     $conn->close();
  27.   ?>
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