In PHP I have a form that stores and read values in the data structure of an array.
<form method="GET">
<input type="checkbox" name="field[field_1]" value="1" <?= ($_GET['field']['field_1']==1) ? 'checked' : ''; ?> />
<input type="checkbox" name="field[field_2]" value="2" <?= ($_GET['field']['field_2']==2) ? 'checked' : ''; ?> />
<input type="checkbox" name="field[field_3]" value="3" <?= ($_GET['field']['field_2']==3) ? 'checked' : ''; ?>/>
<input type="submit" />
</form>
Basically, the code above says that if field_x in the $_GET['field'] array, then mark it as checked. Works beautifully in PHP. The url of the multidimensional array looks like this:
?field%5Bfield_1%5D=0&field%5Bfield_2%5D=1&field%5Bfield_2%5D=1
Now at times from a separate form, the values are trying to be passed by javascript. How can I pass a multidimensional url array from and object so that PHP can read its values from a url?
var object = { field : { field_1 : 1,field_2 : 2, field_3 :3}};
to
/example/url?field%5Bfield_1%5D=0&field%5Bfield_2%5D=1&field%5Bfield_2%5D=1