Advertisement
Guest User

Untitled

a guest
May 10th, 2017
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 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. $nev = $_GET['Nev'];
  12. $nev = "%".$nev."%";
  13.  
  14.  
  15. $stmt = $db->prepare("select * from Legitarsasag where Nev LIKE ?");
  16. $stmt->bind_param('s',$nev);
  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. $ID = $_GET['frissites'];
  27. $uj_nev = $_GET['nev'];
  28. $anyaorszag = $_GET['anyaorszag'];
  29. $alapitasev = $_GET['alapitasev'];
  30.  
  31.  
  32. //Adatbázisba felvitel
  33.  
  34. $stmt = $db->prepare("Update Jarat set Nev=? , Anyaorszag=?, AlapitasEv=? where ID LIKE ?");
  35.  
  36. $stmt->bind_param('sssi',$uj_nev,$anyaorszag,$alapitasev,$ID);
  37. $stmt->execute();
  38. header("Location: features.php");
  39. }
  40.  
  41.  
  42.  
  43.  
  44. ?>
  45.  
  46. <!DOCTYPE HTML>
  47.  
  48. <html>
  49. <head>
  50. <meta charset="UTF-8">
  51.  
  52. <link rel="stylesheet" href="css/style.css" type="text/css">
  53. </head>
  54. <body>
  55. <div id="header">
  56. <div>
  57. <div class="logo">
  58. <a href="index.php"></a>
  59. </div>
  60. <ul id="navigation">
  61. <li>
  62. <a href="index.php">Home</a>
  63. </li>
  64. <li class="active">
  65. <a href="features.php">Search/Update</a>
  66. </li>
  67. <li>
  68. <a href="news.php">Browse</a>
  69. </li>
  70. <li>
  71. <a href="about.php">New line</a>
  72. </li>
  73.  
  74. </ul>
  75. </div>
  76. </div>
  77. <div id="contents">
  78. <div class="clearfix">
  79. <style>
  80. label{display:inline-block;width:100px;margin-bottom:20px;}
  81. </style>
  82. <h1>Please provide new data for the airline company</h1>
  83. <?php $row=$result->fetch_array(MYSQLI_ASSOC)?>
  84. <form method="post" action="features.php">
  85. <label>Airline Name </label>
  86. <input type="text" name="nev" value="<?php echo $row['Nev']?>" />
  87. <br />
  88. <label>Country of origin </label>
  89. <input type="text" name="anyaorszag" value="<?php echo $row['Anyaorszag']?>" />
  90. <br />
  91. <label>Founded </label>
  92. <input type="text" name="alapitasev" value="<?php echo $row['AlapitasEv']?>" />
  93. <br />
  94.  
  95. </table>
  96.  
  97. <br />
  98. <button type="submit" name='frissites' value="<?php echo $row['ID']; ?>">Submit New Airline Company Data</button>
  99. </form>
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106. </div>
  107. </div>
  108.  
  109. </body>
  110. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement