Advertisement
Guest User

Untitled

a guest
May 10th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.75 KB | None | 0 0
  1. <?php
  2. $dbHost = 'localhost';
  3. $dbUsername = 'root';
  4. $dbPassword = '';
  5. $dbName = 'mydb';
  6.  
  7. //Create connection and select DB
  8. $db = new mysqli($dbHost, $dbUsername, $dbPassword, $dbName);
  9. $db->set_charset("utf8");
  10.  
  11. $jaratszam = $_GET['JaratSzam'];
  12. $jaratszam = "%".$jaratszam."%";
  13.  
  14.  
  15. $stmt = $db->prepare("select * from Jarat where JaratSzam LIKE ?");
  16. $stmt->bind_param('s',$jaratszam);
  17. $stmt->execute();
  18. $result = $stmt->POST_result();
  19.  
  20.  
  21.  
  22.  
  23. if (isset($_POST['frissites'])) //Ha megnyomták a frissités gombot
  24. {
  25. //Adatok kinyerése a formokból
  26. $ID = $_POST['frissites'];
  27. $geptipus = $_POST['geptipus'];
  28. $uj_jaratszam = $_POST['jaratszam'];
  29. $indulashely = $_POST['indulashely'];
  30. $erkezeshely = $_POST['erkezeshely'];
  31. $indulasido = $_POST['indulasido'];
  32. $erkezesido = $_POST['erkezesido'];
  33. $legitarsasag = $_POST['legitarsasag'];
  34.  
  35. //Adatbázisba felvitel
  36.  
  37. $stmt = $db->prepare("Update Jarat set Geptipus=? , JaratSzam=?, IndulasHely=?, IndulasIdo=?, ErkezesHely=?, ErkezesIdo=?, Legitarsasag_ID=? where ID=?");
  38. $stmt->bind_param('ssssssii',$geptipus,$uj_jaratszam,$indulashely,$erkezeshely,$indulasido,$erkezesido,$legitarsasag,$ID);
  39. $stmt->execute();
  40.  
  41. header("Location: features.php");
  42. }
  43.  
  44.  
  45.  
  46.  
  47. ?>
  48.  
  49.  
  50.  
  51. <!DOCTYPE HTML>
  52.  
  53. <html>
  54. <head>
  55. <meta charset="UTF-8">
  56.  
  57. <link rel="stylesheet" href="css/style.css" type="text/css">
  58. </head>
  59. <body>
  60. <div id="header">
  61. <div>
  62. <div class="logo">
  63. <a href="index.php"></a>
  64. </div>
  65. <ul id="navigation">
  66. <li>
  67. <a href="index.php">Home</a>
  68. </li>
  69. <li class="active">
  70. <a href="features.php">Search/Update</a>
  71. </li>
  72. <li>
  73. <a href="news.php">Browse</a>
  74. </li>
  75. <li>
  76. <a href="about.php">New line</a>
  77. </li>
  78.  
  79. </ul>
  80. </div>
  81. </div>
  82. <div id="contents">
  83. <div class="clearfix">
  84. <style>
  85. label{display:inline-block;width:100px;margin-bottom:20px;}
  86. </style>
  87.  
  88. <?php $row=$result->fetch_array(MYSQLI_ASSOC)?>
  89. <h1>Please provide new data for the airline</h1>
  90. <form method="POST" action="updatefeatures.html">
  91. <label>Aircraft type </label>
  92. <input type="text" name="geptipus" value= "<?php echo $row['Geptipus']; ?>"/>
  93. <br />
  94. <label>Line number </label>
  95. <input type="text" name="jaratszam" value= "<?php echo $row['JaratSzam']; ?>" />
  96. <br />
  97. <label>Airport </label>
  98. <input type="text" name="indulashely" value ="<?php echo $row['IndulasHely']; ?>" />
  99. <br />
  100. <label>Destination </label>
  101. <input type="text" name="erkezeshely" value="<?php echo $row['ErkezesHely']; ?>" />
  102. <br />
  103. <label>Departure </label>
  104. <input type="text" name="indulasido" value="<?php echo $row['IndulasIdo']; ?>" />
  105. <br />
  106. <label>Time of arrival </label>
  107. <input type="text" name="erkezesido" value ="<?php echo $row['ErkezesIdo']; ?>" />
  108. <br />
  109. <label>Airline ID</label>
  110. <input type="text" name="legitarsasag" value="<?php echo $row['Legitarsasag_ID']; ?>" />
  111. <br />
  112. </table>
  113.  
  114. <br />
  115. <button type="submit" name='frissites' value="<?php echo $row['ID']; ?>">Submit New Line</button>
  116. </form>
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123. </div>
  124. </div>
  125.  
  126. </body>
  127. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement