princesse princesse - 2 months ago 7x
PHP Question

send data via serialised array

i am trying to send data to the server using a serialised array but for a reason I cannot figure out it does not work at all.
I have input text fields and the following cod

$person =array ();
if(isset($_POST['first_name'])) {array_push($person,$_POST['first_name']);}

the hidden input field looks like this

<input type = "hidden" name = "collect" value = "<?php serialise($persons)?>">

The php code is as follows

<?php if(isset($_POST['submit'])){$my_person = unserialise ($persons)}?>

I do not know why but it seems first of all that data does not get pushed into the array and secondly unserialised does not work there is an error that says bool(false). Please could you help me?


Use echo to put value in input

<input type = "hidden" name = "collect" value = "<?php echo serialise($persons)?>">