I am having a problem with a session multi-dimensional array I am trying to add values to. I am told that I should state the array "before" I start adding values, but when I do that the array is treated like a normal array without being a session. Thus, that will not work for my case. At the same time, the code error is ruining my code. I have no idea how I can solve this problem.
Here are the code lines which are causing the error message
Warning: Cannot use a scalar value as an array
(Of course I have more code than this, these are just the lines that affect the issue):
PHP:
for($i=0; $i < count($_POST['part_number']); $i++) {
$_SESSION['qty'][$i] = $_POST['qty'][$i];
}
HTML:
<input type="text" value="1" name="qty[0]" size="2" />
['qty']needs to be an array before you set values to it$_SESSION['qty']? Try:var_dump($_SESSION['qty']);.