Advertisement
Guest User

validation.php

a guest
Oct 20th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.00 KB | None | 0 0
  1. <?php
  2.     $servername = "localhost";
  3.     $username = "root";
  4.     $password = "";
  5.     $dbname = "gymtastic";
  6.     // Create connection
  7.         $conn = new mysqli($servername, $username, $password, $dbname);
  8.     // Check connection
  9.     if ($conn->connect_error) {
  10.         die("Connection failed: " . $conn->connect_error);
  11.     }else{
  12.         echo "Connected <br>";
  13.     }
  14.     if (isset($_POST['value']))    
  15.     {    
  16.           echo "value bestaat <br>";
  17.     }else{
  18.         echo "value bestaat niet <br>";
  19.     }
  20.     if (isset($_POST['name']))    
  21.     {    
  22.           echo "name bestaat <br>";
  23.     }else{
  24.         echo "name bestaat niet <br>";
  25.     }
  26.     if (isset($_POST['selection']))    
  27.     {    
  28.           echo "selection bestaat <br>";
  29.     }else{
  30.         echo "selection bestaat niet <br>";
  31.     }
  32.     if (isset($_POST['heat']))    
  33.     {    
  34.           echo "heat bestaat <br>";
  35.     }else{
  36.         echo "heat bestaat niet <br>";
  37.     }  
  38.  
  39.     if (isset($_POST[''])) {
  40.         $name = $_POST['name'];
  41.         $selection = $_POST['selection'];
  42.         $value = $_POST['value'];
  43.         $heat = $_POST['heat'];
  44.         $sql = "INSERT INTO elements (name, selection, value, heat)VALUES('$name','$selection','$value','heat')";
  45.  
  46.         if (!mysqli_query($conn, $sql)){
  47.             die('Error: ' . mysqli_error($conn));
  48.         }
  49.     }
  50.        
  51. ?>
  52.  
  53. <!DOCTYPE html>
  54. <html>
  55. <head>
  56.     <title>Gymtastic</title>
  57.     <link rel="stylesheet" type="text/css" href="style/style.css">
  58.     <meta charset="utf-8">
  59.     <meta name="viewport" content="width=device-width, initial-scale=1">
  60.     <!-- Latest compiled and minified CSS -->
  61.     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  62.  
  63.     <!-- jQuery library -->
  64.     <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  65.  
  66.     <!-- Latest compiled JavaScript -->
  67.     <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  68. </head>
  69. <body>
  70.     <div class="container">
  71.         <div class="row">
  72.             <div class="col-md-12">
  73.                 <div class="title">
  74.                     <h1>Gymtastic</h1>
  75.                 </div>
  76.             </div>
  77.         </div>
  78.     </div>
  79. </body>
  80. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement