0

I wish to pass an array of arbitrary content via a hidden field in a form which uses the POST method

$targets = any old array;
...
build form to include ...
<input type=hidden id=targets title=targets name=_targets value=\"".htmlspecialchars( serialize( $targets ))."\">

Clearly this requires some use of the htmlspecialchars() or related wrapper functions but I am darned if I can figure out a combination which is guaranteed to work for an array of arbitrary content.

Any help appreciated & I can readily figure out how to unserialize($_POST) from your reply

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by haggis-man
0

If I simply put value=serialize( $targets ) my form does not display properly though.

I need $targets to be made available to the routine handling the POSTed data.

0

Got it :)

base64_encode( serialize( ))
...
unserialize( base64_decode( ))

Thank you for reading.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.