Guest User

Untitled

a guest
Aug 22nd, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.34 KB | None | 0 0
  1. <form id="contact-form" method="post" action="cms_data.php" role="form">
  2. <div class="col-sm-12">
  3. <h2>id</h2>
  4. <input name="id" type="text" placeholder="<?php echo $id;?>" value="1">
  5. </div>
  6. <div class="col-sm-12">
  7. <h2>Omschrijving</h2>
  8. <textarea name="omschrijving" type="text" style="height:220px;width:100%;resize:none;"><?php echo $omschrijving;?></textarea>
  9. </div>
  10. <div class="col-sm-12">
  11. <h2>Datum</h2>
  12. <input name="datum" type="text" value="<?php echo $datum;?>">
  13. </div>
  14. <div class="col-sm-12">
  15. <h2>Tijd</h2>
  16. <input name="tijd" type="text" value="<?php echo $tijd;?>">
  17. </div>
  18. <div class="col-sm-12">
  19. <h2>Locatie</h2>
  20. <input name="locatie" type="text" value="<?php echo $locatie;?>">
  21. </div>
  22. <div class="col-sm-12">
  23. <h2>Dresscode</h2>
  24. <input name="dresscode" type="text" value="<?php echo $dresscode;?>">
  25. </div>
  26. <div class="col-sm-12 text-right">
  27. <input type="submit" class="btn btn-success btn-send" value="Versturen" id="sent" <?php // echo $_SESSION['disabled']; ?>>
  28. <a href="update-cms.php">Update </a>
  29. </div>
  30. </form>
  31.  
  32. <?php session_start();?>
  33. <?php
  34. $servername = "localhost";
  35. $username = "xxx";
  36. $password = "xxx";
  37. $dbname = "xxx";
  38.  
  39. // Create connection
  40. $conn = mysqli_connect($servername, $username, $password, $dbname);
  41. //echo '<div style="width:100%;background:green;color:#FFF;font-size:2rem;text-align:center;">Connected to '. $dbname. '</div>';
  42.  
  43. // Check connection
  44. if (!$conn) {
  45. die("Connection failed: " . mysqli_connect_error());
  46. }
  47.  
  48. $id = $_POST['id'];
  49. $omschrijving = $_POST["omschrijving"];
  50. $datum = $_POST["datum"];
  51. $item = $_POST["tijd"];
  52. $locatie = $_POST["locatie"];
  53. $dresscode = $_POST["dresscode"];
  54.  
  55. $quote = iconv("UTF-8", "WINDOWS-1252//TRANSLIT");
  56. $date = date('Y-m-d');
  57. date_default_timezone_set("Europe/Amsterdam");
  58. $time = date("h:i:sa");
  59. $sql = "INSERT INTO $table (ID, Omschrijving, Datum, Tijd, Locatie, Dresscode )
  60. VALUES ('" .$id."','" .$omschrijving."','".$datum."',' ".$item."','".$locatie."','".$dresscode."')";
  61.  
  62. if ($conn->query($sql) === TRUE) {
  63. echo "";
  64. } else {
  65. echo "Error: " . $sql . "<br>" . $conn->error;
  66. }
  67.  
  68. $conn->close();
  69. ?>
  70.  
  71. <?php session_start();?>
  72. <?php
  73. $servername = "localhost";
  74. $username = "xxx";
  75. $password = "xxx";
  76. $dbname = "xxx";
  77.  
  78. // Create connection
  79. $conn = mysqli_connect($servername, $username, $password, $dbname);
  80. //echo '<div style="width:100%;background:green;color:#FFF;font-size:2rem;text-align:center;">Connected to '. $dbname. '</div>';
  81.  
  82. // Check connection
  83. if (!$conn) {
  84. die("Connection failed: " . mysqli_connect_error());
  85. }
  86.  
  87. $id = $_POST['id'];
  88. $omschrijving = $_POST["omschrijving"];
  89. $datum = $_POST["datum"];
  90. $item = $_POST["tijd"];
  91. $locatie = $_POST["locatie"];
  92. $dresscode = $_POST["dresscode"];
  93.  
  94. $quote = iconv("UTF-8", "WINDOWS-1252//TRANSLIT");
  95. $date = date('Y-m-d');
  96. date_default_timezone_set("Europe/Amsterdam");
  97. $time = date("h:i:sa");
  98. $sql = "UPDATE $table SET
  99. Omschrijving = '$omschrijving', Datum = '$datum', Tijd = '$item', Locatie = '$locatie', Dresscode = '$dresscode' WHERE ID = '1'";
  100.  
  101. if ($conn->query($sql) === TRUE) {
  102. echo "Done";
  103. } else {
  104. echo "Error: " . $sql . "<br>" . $conn->error;
  105. }
  106.  
  107. $conn->close();
  108. ?>
Add Comment
Please, Sign In to add comment