Advertisement
Guest User

Untitled

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