Guest User

Untitled

a guest
May 13th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. <?php
  2. $servername = "localhost";
  3. $username = "root";
  4. $password = "";
  5. $dbname = "myDB";
  6. $firstname = "";
  7. $lastname = "";
  8. $email = "";
  9. $country = "";
  10. $mobile = "";
  11. $password = "";
  12. $touristId = "";
  13.  
  14. // Create connection
  15. $conn = new mysqli($servername, $username, $password, $dbname);
  16.  
  17. // Check connection
  18. if ($conn->connect_error) {
  19. die("Connection failed: " . $conn->connect_error);
  20. }
  21. echo "Connected successfully";
  22.  
  23. $hotelname = $_POST["dhotelname"];
  24. $hoteladdress = $_POST["dhoteladdress"];
  25. $hotelcontact = $_POST["dhotelcontact"];
  26. $hotelcharges = $_POST["dhotelcharges"];
  27. $hotelnearestrail = $_POST["dhotelnearestrail"];
  28. $hotelnearestair = $_POST["dhotelnearestair"];
  29. var_dump($mobile);
  30. // Create database
  31. $sql = "INSERT INTO hotel (hotel_name, contact_no, address, charges,nearest_rail,nearest_air)
  32. VALUES ('$hotelname', '$hotelcontact', '$hoteladdress', '$hotelcharges', '$hotelnearestrail','$hotelnearestair')";
  33.  
  34. if ($conn->query($sql) === TRUE) {
  35. header("Location:welcome.php");
  36. } else {
  37. echo "Error: " . $sql . "<br>" . $conn->error;
  38. }
  39.  
  40. $conn->close();
  41. ?>
Add Comment
Please, Sign In to add comment