I have big form and had to serialize a part of it before sending to PHP to get rid of the limitation of "max_input_vars"
I want to convert the encoded value with PHP as orginal $_POST value.
I guess all i need to convert it to an object after decoded the post value but couldn't found the way.
Any help is really appreciated.
Best Regards
UPDATE: Here are the codes;
here is how I encode the form with javascript
//searialize the form
serialize_form = $(thisForm).serialize();
serialize_form = "serialize_form="+encodeURIComponent(serialize_form);
Then in my php file;
$formValues = urldecode( $_POST["serialize_form"] );
My php code was working fine before encode the serialized form, all need to have the same object with php after urldecode.
jQuery's serialize()
returns something like this (taken from example on that page):
single=Single2&multiple=Multiple3&check=check2&radio=radio2
PHP has a function called parse_str
that works like this:
void parse_str ( string $str [, array &$arr ] )
Usage example:
$str = "first=value&arr[]=foo+bar&arr[]=baz";
parse_str($str);
echo $first; // value
echo $arr[0]; // foo bar
echo $arr[1]; // baz
parse_str($str, $output);
echo $output['first']; // value
echo $output['arr'][0]; // foo bar
echo $output['arr'][1]; // baz
So call parse_str
on your input and you can get either a list of variables or an array. I would do an array.