I have a custom form with min and max price value:
$form['price']['min'] = [
'#type' => 'hidden',
'#default_value' => isset($_GET['price']['min']) ? $_GET['price']['min'] : '',
'#attributes' => ['id' => 'price-min'],
];
$form['price']['max'] = [
'#type' => 'hidden',
'#default_value' => isset($_GET['price']['max']) ? $_GET['price']['max'] : '',
'#attributes' => ['id' => 'price-max'],
];
and I would like the URL after the form is submitted to look like this:
/search?price%5Bmin%5D=5000&price%5Bmax%5D=10000
but actually it's coming out like this:
/search?min=5000&max=10000
How can I get the form values to appear in the URL in the required format?
$_GET
in your form, but get the parameters from the request object.