Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include_once '../incluedes/conn_cms.php';//session started here
- if(isset($_POST['submit_post'])){
- $date = date('Y-m-d');
- $size = isset($_POST['size']) ? $_POST['size'] : array();
- $numero = isset($_POST['numero']) ? $_POST['numero'] : array();
- $vari = isset($_POST['vari']) ? $_POST['vari'] : array();
- $desenho = isset($_POST['desenho']) ? $_POST['desenho'] : array();
- $fabrics= isset($_POST['fabric']) ? $_POST['fabric'] : array();
- $size = isset($_POST['size']) ? $_POST['size'] : array();
- $qnty = isset($_POST['qnty']) ? $_POST['qnty'] : array();
- $cost = isset($_POST['cost']) ? $_POST['cost']: array();
- $subtotal = isset($_POST['subtotal']) ? $_POST['subtotal'] : array();
- $total = isset($_POST['total']) ? $_POST['total'] : array();
- $all_products = isset($_POST['all_products']) ? $_POST['all_products'] : array();
- $pedido=$date." ".$_SESSION['userName']."-".$_SESSION['userLName'];
- foreach ($fabrics as $fabric)
- {
- $index = array_search($fabric, $fabrics);
- $query = "SELECT * FROM almofadas WHERE id_price='$fabrics[$index]'";
- $result = mysqli_query($conn,$query);
- while($rows = mysqli_fetch_assoc($result)){
- $tecido=$rows['tecido']; //
- }
- $ins_sql = "INSERT INTO orders (fabric,size,product_quantity,order_id,product_img,product_title,variante,product_cost,product_subtotal)
- VALUES ('$tecido', '$size[$index]' , '$qnty[$index]', '$pedido', '$desenho[$index]', '$numero[$index]', '$vari[$index]', '$cost[$index]', '$subtotal[$index]')";
- if ($conn->query($ins_sql) === TRUE) {
- echo "New record created successfully";
- } else {
- echo "Error: " ;
- }
- }
- $conn->close();
- unset($_SESSION['Products_cart']);
- }
Advertisement
Add Comment
Please, Sign In to add comment