0
After a query, I am sending different values through the same variable (through an input):
<input type="hidden" id="sku" name="sku" value="<?= $reg->sku ?>">
This way, my URL is as follows:
http://localhost/admin/anuncios/relatorios/exportado_confirm.php?sku=BL001_BA307&sku=BL001_BA308&sku=BL001_BA667&sku=BL001_BA668&sku=BL001_BA672&sku=BL003_BA309&sku=BL005_BA27&sku=BL166_BA7&sku=BL166_BA8&sku=BL178_BA310&sku=BL184_BA1&sku=BL184_BA4&sku=BL184_BA669&sku=BL202_BA5
But I can’t then capture all the "sku" sent through the $sku = $_GET['sku']);
'Cause when I run the next round UPDATE
: $sql = "update anuncios set exportado = '1' where sku = '{$sku}'";
It can only capture the last value sent in the "sku" variable and run the UPDATE in that last "sku" listed in the URL.
I wish I could capture all the values, and this UPDATE
rotate (while) while there is some value in the sku variable. Does anyone have any suggestions to help me?
Note: I’m actually doing everything by POST, just put by GET to be visible the values sent in the same variable.
Try to define the field
input
withname="sku[]"
, adding the brackets. Thus, I believe that$_GET["sku"]
will be a array, but remember to convert it properly to string before using in SQL query.– Woss
Do you know how to use the explode? It might help. $skus = explode('&', $_GET); after that just give a Count(skus) to know the number of values returned
– Bsalvo
a little confusion that there, starts with get and in the end becomes post and is only an input, if it is only an input for that bracket in name?
– user60252