[SOLVED] Unserialize parameter problem
Posted: Sun Oct 10, 2010 6:55 pm
Hi, I'm trying to pass an array in an hidden field, serializing it, but I got nothing when I unserialize it.
I serialize a parameter and pass it in an hidden field, in this way:
Pass the hidden field to Smarty:
If I don't decode/unserialize,
Thanks
I serialize a parameter and pass it in an hidden field, in this way:
(where "$arr_id" is an array of id).$arr_hidden_ids=base64_encode(serialize($arr_id));
Pass the hidden field to Smarty:
In the source of the generated page I have:$this->smarty->assign('hidden_ids', $this->CreateInputHidden($id, 'hidden_ids[]',$arr_hidden_ids ));
then, I decode and unserialize the parameter when receiving the submitted form:
It prints nothing.$arr_hidden_ids=base64_decode(unserialize($params['hidden_ids']));
print_r($arr_hidden_ids);
If I don't decode/unserialize,
It prints:$arr_hidden_ids=$params['hidden_ids'];
print_r($arr_hidden_ids);
Why? What am I doing wrong?Array ( [0] => YToyOntpOjA7czoyOiIxMCI7aToxO3M6MToiOSI7fQ== )
Thanks