Advertisement
Guest User

Untitled

a guest
Apr 14th, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.33 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.  
  13. //fetching a value from HTML form
  14. $product = filter_input(INPUT_POST, 'product'); // Storing Selected Value In Variable
  15. $month = filter_input(INPUT_POST, 'month'); // Storing Selected Value In Variable
  16. $avgdsales = filter_input(INPUT_POST, 'avgDailySales'); // Storing Selected Value In Variable
  17.  
  18. //start connection
  19. $user='root';
  20. $pass='';
  21. $db='beauty shop'; //our db name
  22. $connection = new mysqli('localhost',$user,$pass,$db) or die( "Could not connect to database " );
  23.  
  24. if ($product == "eayliner")
  25. {
  26. $result = mysql_query("SELECT ID, ProductType, Lead, Safety_Stock FROM channel WHERE id='1'"); // chanel table
  27. if (!$result) {
  28. echo 'Could not run query: ' . mysql_error();
  29. exit;
  30. }
  31. $row = mysql_fetch_row($result);
  32. $p_id = $row['ID'];
  33. $p_type = $row['ProductType'];
  34. $p_lead = $row['Lead'];
  35. $p_safetystock = $row['Safety_Stock'];
  36.  
  37. $leadtimedemand = $lead * $avgdsales;
  38. $reorderpoint = $leadtimedemand + $safty_stock;
  39.  
  40. $sql = "INSERT INTO eayliner (ProductID, Month, AvgDailySales, rOPoint)
  41. VALUES ($p_id, $month, $avgdsales, $reorderpoint)";
  42.  
  43. 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>');
  44. }
  45.  
  46. //end of eyeliner if
  47. else
  48.  
  49. if ($product == "eyeshadow") {
  50. $result = mysql_query("SELECT ID, ProductType, Lead, Safety_Stock FROM channel WHERE id='2'"); // chanel table
  51. if (!$result) {
  52. echo 'Could not run query: ' . mysql_error();
  53. exit;
  54. }
  55. $row = mysql_fetch_row($result);
  56. $p_id = $row['ID'];
  57. $p_type = $row['ProductType'];
  58. $p_lead = $row['Lead'];
  59. $p_safetystock = $row['Safety_Stock'];
  60.  
  61. $leadtimedemand = $lead * $avgdsales;
  62. $reorderpoint = $leadtimedemand + $safty_stock;
  63.  
  64. $sql = "INSERT INTO eyeshadow (ProductID, Month, AvgDailySales, rOPoint)
  65. VALUES ($p_id, $month, $avgdsales, $reorderpoint)";
  66. 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>');
  67. }
  68.  
  69. //end of eyeshadow if
  70. else
  71. if ($product == "lipstick") {
  72. $result = mysql_query("SELECT ID, ProductType, Lead, Safety_Stock FROM channel WHERE id='3'"); // chanel table
  73. if (!$result) {
  74. echo 'Could not run query: ' . mysql_error();
  75. exit;
  76. }
  77. $row = mysql_fetch_row($result);
  78. $p_id = $row['ID'];
  79. $p_type = $row['ProductType'];
  80. $p_lead = $row['Lead'];
  81. $p_safetystock = $row['Safety_Stock'];
  82.  
  83. $leadtimedemand = $lead * $avgdsales;
  84. $reorderpoint = $leadtimedemand + $safty_stock;
  85.  
  86. $sql = "INSERT INTO lipstick (ProductID, Month, AvgDailySales, rOPoint)
  87. VALUES ($p_id, $month, $avgdsales, $reorderpoint)";
  88. 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>');
  89. }
  90. //end of lipstick if
  91.  
  92.  
  93. //end of if the user didnt select any product
  94. mysqli_close($connection);
  95. ?>
  96. <div>
  97. <footer id="footer">
  98. <h6>COPYRIGHT &copy My Beauty Shop ALL RIGHTS RESERVED.</h6>
  99. </footer> <!-- End of Footer -->
  100. </div>
  101. </body>
  102. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement