简体   繁体   中英

Get request for url with [ ] in it

I need to get the value of a parameter in the URL which isn't set by me and out of my control. It is a drop down menu with various options, yes, no, maybe.

It looks like this:

<select name="abc_filter[2z51292c01075]">
 <option>Yes</option>
 <option>No</option>
 <option>Maybe</option>
</select>

I tried echo $_GET['abc_filter[2z51292c01075]'] but the result is always empty/nothing instead of either yes, no or maybe depending on what is selected.

If you var_dump($_GET['abc_filter']); you'll get something like array(1) { ["2z51292c01075"]=> string(2) "Yes" } . $_GET['abc_filter'] is an array, so you can use

$_GET['abc_filter']['2z51292c01075']

to access the value with key 2z51292c01075.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM