Reputation: 11
I have the following code...
<?php
if ($_GET['custom_fields%5Bcartredirectmb%5D'] == 'test')
{ header("Location: http://www.google.com"); exit(); }
?>
I just need this code to get the parameter 'custom_fields[cartredirectmb]' and redirect based on its value.
It looks like it's hung up on the brackets in the parameter. I've tried using urlencode, but I'm not getting anywhere. I assume there's a simple answer to this get working.
Feedback? Thanks!
Upvotes: 1
Views: 27
Reputation: 60597
PHP automatically expands array expressions in the URL into the $_GET
variable.
The following variable in the URL,
?custom_fields[cartredirectmb]=test
can be accessed through the cartredirectmb
key, in the custom_fields
array in the URL.
$_GET['custom_fields']['cartredirectmb']
Upvotes: 1