Save cart information, order it and then take it out?

the road is dead!

assume that I am now in the store
I would like to save my current property information
and then press the button to use it. Give it to mysql
but I have a problem
how can I propose to save it?
I now have two must

<input type="hidden" name="cart_prod_id[]" value="<?=$row["prod_id"];?>">
<input type="hidden" name="cart_quantity[]" value="<?=$row["quan"];?>">

one is the quantity, the other is the commodity ID
but how can I receive it at the other end?
this is where my receiver writes

$_SESSION["cart_prod_id"] = $cart_prod_id;
print_r($_SESSION["cart_prod_id"]);

he is printing out

Array ( [0] => 11 [1] => 5 )

but it doesn"t seem to be what I want?
I may need to know which product ID, quantity, and unit
should be saved in what format? Json? How to implement
?

the other one I wrote doesn"t seem to be what I want?

$_SESSION["cart"] = array("prod-id" => $cart_prod_id , "quan" => $cart_quantity);
    echo json_encode($_SESSION["cart"]);
    
    // {"prod-id":["11","5"],"quan":["3","3"]}

what kind of child do you usually have to grow up to be?


there are two numbers 11 and 2323.
generally speaking, as long as the backend can understand it

{
    "11": 2,
    "2323": 100
}

is fine

[{
    "pid": "11",
    "number": 2
},{
    "pid": "2323",
    "number": 100
}]

even this is fine

[[112][2323 100]]

the agreement is self-made. As long as the agreement is made, the data format is not a big problem.
as for how to implement it, Google will do it

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3fa56-2c4c7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3fa56-2c4c7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?