php gives the ability to send arrays from the _GET.
example:
test.php?var1=abc&arr[0]=1&arr[3]=test
will output:
Array
(
[var1] => abc
[arr] => Array
(
[0] => 1
[3] => test
)
)
is this consider bad coding?
You can pass an associative array to http_build_query() and append the resulting string as the query string to the URL. The array will automatically be parsed by PHP so $_GET on the receiving page will contain an array.
Postman allows anyone to send any kind of array with their request, you just need to know how.
The PHP built-in variable $_POST is also an array and it holds the data that we provide along with the post method.
You can use session, save the value in session and in another page where you want the array you get the value from the session. You can implode the array value using any specific special character and send the value to where you want then get the value in that page then explode the value.
No, it's usual practice. Also it's natural practice for sending selects with size greater than one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With