Advertisement
Guest User

Untitled

a guest
Apr 14th, 2018
114
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.  
  27. $result = mysql_query("SELECT ID, ProductType, Lead, Safety_Stock FROM channel WHERE id='1'"); // chanel table
  28. if (!$result) {
  29. echo 'Could not run query: ' . mysql_error();
  30. exit;
  31. }
  32. $row = mysql_fetch_row($result);
  33. $p_id = row['ID'];
  34. $p_type = row['ProductType'];
  35. $p_lead = row['Lead'];
  36. $p_safetystock = row['Safety_Stock'];
  37.  
  38. $leadtimedemand = $lead * $avgdsales;
  39. $reorderpoint = $leadtimedemand + $safty_stock;
  40.  
  41. $sql = "INSERT INTO eayliner (ProductID, Month, AvgDailySales, rOPoint)
  42. VALUES ($p_id, $month, $avgdsales, $reorderpoint)";
  43.  
  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.  
  47. //end of eyeliner if
  48. else
  49.  
  50. if ($product == "eyeshadow") {
  51. $result = mysql_query("SELECT ID, ProductType, Lead, Safety_Stock FROM channel WHERE id='2'"); // chanel table
  52. if (!$result) {
  53. echo 'Could not run query: ' . mysql_error();
  54. exit;
  55. }
  56. $row = mysql_fetch_row($result);
  57. $p_id = row['ID'];
  58. $p_type = row['ProductType'];
  59. $p_lead = row['Lead'];
  60. $p_safetystock = row['Safety_Stock'];
  61.  
  62. $leadtimedemand = $lead * $avgdsales;
  63. $reorderpoint = $leadtimedemand + $safty_stock;
  64.  
  65. $sql = "INSERT INTO eyeshadow (ProductID, Month, AvgDailySales, rOPoint)
  66. VALUES ($p_id, $month, $avgdsales, $reorderpoint)";
  67. 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>');
  68. }
  69.  
  70. //end of eyeshadow if
  71. else
  72. if ($product == "lipstick") {
  73. $result = mysql_query("SELECT ID, ProductType, Lead, Safety_Stock FROM channel WHERE id='3'"); // chanel table
  74. if (!$result) {
  75. echo 'Could not run query: ' . mysql_error();
  76. exit;
  77. }
  78. $row = mysql_fetch_row($result);
  79. $p_id = row['ID'];
  80. $p_type = row['ProductType'];
  81. $p_lead = row['Lead'];
  82. $p_safetystock = row['Safety_Stock'];
  83.  
  84. $leadtimedemand = $lead * $avgdsales;
  85. $reorderpoint = $leadtimedemand + $safty_stock;
  86.  
  87. $sql = "INSERT INTO lipstick (ProductID, Month, AvgDailySales, rOPoint)
  88. VALUES ($p_id, $month, $avgdsales, $reorderpoint)";
  89. 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>');
  90. }
  91. //end of lipstick if
  92.  
  93.  
  94. //end of if the user didnt select any product
  95. mysqli_close($connection);
  96. ?>
  97. <div>
  98. <footer id="footer">
  99. <h6>COPYRIGHT &copy My Beauty Shop ALL RIGHTS RESERVED.</h6>
  100. </footer> <!-- End of Footer -->
  101. </div>
  102. </body>
  103. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement