Guest User

Untitled

a guest
Apr 12th, 2018
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.81 KB | None | 0 0
  1. <!DOCTYPE html>
  2.  
  3. <html>
  4. <head>
  5. <meta charset="utf-8">
  6. <title>My Beauty Shop</title>
  7. <link rel="stylesheet" type="text/css" href="Styling.css" />
  8. </head>
  9. <body>
  10. <header><h1><img id="Logoimg" src="logo.jpg" height="200" /></h1></header> <!-- End of header -->
  11. <?php
  12. //Take the input
  13.  
  14. $product = $_POST['product'];
  15. $month = $_POST['month'];
  16. $avgdsales = $_POST['avgDailysales'];
  17.  
  18. // End of the input
  19. $leadtimedemand; // = Lead * avgdsales
  20. $reorderpoint; // = leadtimedemand + saftystock
  21. // Create new connection
  22. $user='root';
  23. $pass='';
  24. $db=''; //our db name
  25. $con= new mysqli('localhost',$user,$pass,$db) or die( "Could not connect to database " );
  26. if ($con->connect_error) {
  27. die("Connection failed: " . $con->connect_error);
  28. }
  29. // end of connection
  30.  
  31. if ($product == "eyeliner") {
  32. $sql = "SELECT * FROM chanel";
  33. $result = mysql_query($sql) or die (mysql_error());
  34. $row = $result->fetch_assoc();
  35. $prodcutid = $row['ID'];
  36. $lead = $row["Lead"]; // lead time
  37. $safty_stock = $row["safty_stock"];
  38.  
  39. $leadtimedemand = $lead * $avgdsales;
  40. $reorderpoint = $leadtimedemand + $safty_stock;
  41.  
  42. $psql = "INSERT INTO eyeliner (productID, month, avgDsales, rOPoint)
  43. VALUES ($prodcutid, $month, $avgdsales, $reorderpoint)";
  44. print('<h3>after making somoe calculations we found that you have to order more eyeliners after '. $reorderpoint . ' since the lead time takes '. $lead . ' and your safty stock is ' . $safty_stock . 'and your average daily sales is ' . $avgdsales . '</h3>');
  45. }
  46. //end of eyeliner if
  47.  
  48. if ($product == "eyeshadow") {
  49. $sql = "SELECT * FROM chanel";
  50. $result = mysql_query($sql) or die (mysql_error());
  51. $row = $result->fetch_assoc();
  52. $prodcutid = $row['ID'];
  53. $lead = $row["Lead"]; // lead time
  54. $safty_stock = $row["safty_stock"];
  55.  
  56. $leadtimedemand = $lead * $avgdsales;
  57. $reorderpoint = $leadtimedemand + $safty_stock;
  58.  
  59. $psql = "INSERT INTO eyeshadow (productID, month, avgDsales, rOPoint)
  60. VALUES ($prodcutid, $month, $avgdsales, $reorderpoint)";
  61. print('<h3>after making somoe calculations we found that you have to order more eyeshadows after '. $reorderpoint . ' since the lead time takes '. $lead . ' and your safty stock is ' . $safty_stock . 'and your average daily sales is ' . $avgdsales . '</h3>');
  62. }
  63. //end of eyeshadow if
  64. if ($product == "lipstick") {
  65. $sql = "SELECT * FROM chanel";
  66. $result = mysql_query($sql) or die (mysql_error());
  67. $row = $result->fetch_assoc();
  68. $prodcutid = $row['ID'];
  69. $lead = $row["Lead"]; // lead time
  70. $safty_stock = $row["safty_stock"];
  71.  
  72. $leadtimedemand = $lead * $avgdsales;
  73. $reorderpoint = $leadtimedemand + $safty_stock;
  74.  
  75. $psql = "INSERT INTO lipstick (productID, month, avgDsales, rOPoint)
  76. VALUES ($prodcutid, $month, $avgdsales, $reorderpoint)";
  77. print('<h3>after making somoe calculations we found that you have to order more lipsticks after '. $reorderpoint . ' since the lead time takes '. $lead . ' and your safty stock is ' . $safty_stock . 'and your average daily sales is ' . $avgdsales . '</h3>');
  78. }
  79. //end of lipstick if
  80. if ($product != "lipstick" && $product != "eyeliner" && $product != "eyeshadow") {
  81.  
  82. print 'You didnt select any product please try again';
  83. }
  84. //end of if the user didnt select any product
  85. mysqli_close($con);
  86. ?>
  87. <div>
  88. <footer id="footer">
  89. <h6>COPYRIGHT &copy My Beauty Shop ALL RIGHTS RESERVED.</h6>
  90. </footer> <!-- End of Footer -->
  91. </div>
  92. </body>
  93. </html>
Add Comment
Please, Sign In to add comment