Guest User

Untitled

a guest
Nov 12th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. <head>
  2. <meta charset="utf-8">
  3. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  4. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  5. <title>Progressive Web Application - MAM11</title>
  6. <link rel="stylesheet" href="styles/main.css">
  7. <script src="scripts/app.js" async></script>
  8. </head>
  9. <body>
  10.  
  11. <h1>Pill-Explainer</h1>
  12.  
  13. <p>Please enter the European Article Number (EAN) of your medication below. <br>
  14. You can find the EAN at the outside of your medication box often starting with the number 8 and containing 13 digits in total. </p>
  15.  
  16. <img src="images/barcode.jpg"> <br>
  17.  
  18. <form action="http://192.168.0.104/MedicationProject/result.php" method="post">
  19.  
  20. <input type="number" placeholder="Enter barcode" name="barcode" id="barcode"> <br>
  21. <input type="submit" value="Get medication" id="submit">
  22. </form>
  23.  
  24. </body>
  25.  
  26. <?php
  27. // 1. database credentials
  28. $host = "sql7.freemysqlhosting.net";
  29. $db_name = "sql7264357";
  30. $username = "sql7264357";
  31. $password = "*********";
  32.  
  33. // 2. connect to database
  34. $con = new PDO("mysql:host={$host};dbname={$db_name}", $username, $password);
  35.  
  36. // 3. get barcode value from inputfield in previous document
  37. $search=$_POST['barcode'];
  38.  
  39. // 4. prepare select query
  40. $query = 'SELECT ProductName, ActiveIngredient, Description, Leaflet
  41. FROM Medications WHERE Barcode = "'.$search.'"';
  42. $stmt = $con->prepare( $query );
  43.  
  44. // 5. execute our query
  45. $stmt->execute();
  46.  
  47. // 6. store retrieved row to the 'row' variable
  48. $row = $stmt->fetch(PDO::FETCH_ASSOC);
  49. ?>
  50.  
  51. <head>
  52. <meta charset="utf-8">
  53. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  54. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  55. <title>Progressive Web Application - MAM11</title>
  56. <link rel="stylesheet" href="styles/result.css">
  57. </head>
  58. <body>
  59.  
  60. <h1>Pill-Explainer</h1>
  61.  
  62.  
  63. <form action="/action_page.php">
  64.  
  65. <label>Productname:</label>
  66. <textarea type="text" id="productname"><?php echo $row['ProductName']?></textarea>
  67.  
  68. <label>Active ingredient:</label>
  69. <textarea type="text" id="ingredient"><?php echo $row['ActiveIngredient']?></textarea>
  70.  
  71. <label>Description:</label>
  72. <textarea type="text" id="description"><?php echo $row['Description']?></textarea>
  73.  
  74. </form>
  75.  
  76. <div id="buttons">
  77. <a href="index.html">
  78. <img src="images/back-button.jpg">
  79. </a>
  80.  
  81. <a href="<?php echo $row['Leaflet']?>">
  82. <button type="button">Download leaflet <br> (Internet only)</button>
  83. </a>
  84. </div>
  85.  
  86. </body>
Add Comment
Please, Sign In to add comment