About how to use session? Who can fix this code?

<?php session_start(); if(isset($_POST['store'])){ $_SESSION[' '][] = array( 'number' => '', $name ='name' => $_POST["name"], $product ='product' => $_POST["product"], $quailty ='quailty' => $_POST["quailty"], $price ='price' => $_POST["price"], 'amount' => '', ); } ?> Using POST Method Session And Array

Stock Keeping Unit

Stock Card Input

" method="post">
Name*
Product Name *
Qty *
Price *

Stock Table Show

<?php if(isset($_POST['store'])){ //Loop row one by one when click save or store for($a = 1; $a < count($_SESSION[' ']); $a++){ ?> <?php //Multiplecation of column Amount for one row inside loop $_SESSION[' '][$a]['amount'] = //Value of Quailty (int)$_SESSION[' '][$a]['quailty'] * //Value of Price (int)$_SESSION[' '][$a]['price']; //Loop All Data foreach($_SESSION[' '][$a] as $key => $detail){ if($key == 'number'){ echo ""; }else if($key == 'name'){ echo ""; }else if($key == 'product'){ echo ""; }else if($key == 'quailty'){ echo ""; }else if($key == 'price'){ echo ""; }else if($key == 'amount'){ echo ""; } } ?> <?php } //Loop Sum or Total of All Amount Column $sum = 0; for($b = 1; $b < count($_SESSION[' ']); $b++){ $sum += (int)$_SESSION[' '][$b]['amount']; } ?>
N Name Product Name Qty Price Amount
$a ". $detail ." ". $detail ." ". $detail ." $". $detail ." $". $detail ."
Total: <?php echo $sum .'$'; } ?>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.