Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>My Beauty Shop</title>
- <link rel="stylesheet" type="text/css" href="Styling.css" />
- </head>
- <body>
- <header><h1><img id="Logoimg" src="logo.jpg" height="200" /></h1></header> <!-- End of header -->
- <?php
- //fetching a value from HTML form
- $product = filter_input(INPUT_POST, 'product'); // Storing Selected Value In Variable
- $month = filter_input(INPUT_POST, 'month'); // Storing Selected Value In Variable
- $avgdsales = filter_input(INPUT_POST, 'avgDailysales'); // Storing Selected Value In Variable
- //start connection
- $user='root';
- $pass='';
- $db='beauty shop'; //our db name
- $connection = new mysqli('localhost',$user,$pass,$db) or die( "Could not connect to database " );
- if ($product == "eayliner")
- {
- $result = mysql_query("SELECT ID, ProductType, Lead, Safety_Stock FROM channel WHERE id='1'"); // chanel table
- if (!$result) {
- echo 'Could not run query: ' . mysql_error();
- exit;
- }
- $row = mysql_fetch_row($result);
- $p_id = row['ID'];
- $p_type = row['ProductType'];
- $p_lead = row['Lead'];
- $p_safetystock = row['Safety_Stock'];
- $leadtimedemand = $lead * $avgdsales;
- $reorderpoint = $leadtimedemand + $safty_stock;
- $sql = "INSERT INTO eayliner (ProductID, Month, AvgDailySales, rOPoint)
- VALUES ($p_id, $month, $avgdsales, $reorderpoint)";
- 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>');
- }
- //end of eyeliner if
- else
- if ($product == "eyeshadow") {
- $result = mysql_query("SELECT ID, ProductType, Lead, Safety_Stock FROM channel WHERE id='2'"); // chanel table
- if (!$result) {
- echo 'Could not run query: ' . mysql_error();
- exit;
- }
- $row = mysql_fetch_row($result);
- $p_id = row['ID'];
- $p_type = row['ProductType'];
- $p_lead = row['Lead'];
- $p_safetystock = row['Safety_Stock'];
- $leadtimedemand = $lead * $avgdsales;
- $reorderpoint = $leadtimedemand + $safty_stock;
- $sql = "INSERT INTO eyeshadow (ProductID, Month, AvgDailySales, rOPoint)
- VALUES ($p_id, $month, $avgdsales, $reorderpoint)";
- 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>');
- }
- //end of eyeshadow if
- else
- if ($product == "lipstick") {
- $result = mysql_query("SELECT ID, ProductType, Lead, Safety_Stock FROM channel WHERE id='3'"); // chanel table
- if (!$result) {
- echo 'Could not run query: ' . mysql_error();
- exit;
- }
- $row = mysql_fetch_row($result);
- $p_id = row['ID'];
- $p_type = row['ProductType'];
- $p_lead = row['Lead'];
- $p_safetystock = row['Safety_Stock'];
- $leadtimedemand = $lead * $avgdsales;
- $reorderpoint = $leadtimedemand + $safty_stock;
- $sql = "INSERT INTO lipstick (ProductID, Month, AvgDailySales, rOPoint)
- VALUES ($p_id, $month, $avgdsales, $reorderpoint)";
- 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>');
- }
- //end of lipstick if
- //end of if the user didnt select any product
- mysqli_close($connection);
- ?>
- <div>
- <footer id="footer">
- <h6>COPYRIGHT © My Beauty Shop ALL RIGHTS RESERVED.</h6>
- </footer> <!-- End of Footer -->
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement