Another idea:
PHP Code:
<?php
$fieldValue = array(
'id' => 2,
'name' => 'george',
);
?>
<input type="hidden" name="whatever" value="<?php echo base64_encode(serialize($fieldValue)) ?>" />
.....
as POST
<?php
$postedValue = unserialize(base64_decode($_POST['whatever']));
?>
Now, as I can see the issue, you don't need all this things... you just need one value (ID or other thing) to keep a sync. Example:
PHP Code:
<?php
$posibleValues = array(
2 => array( 'key1' => 'val1' ),
5 => array( 'key2' => 'val2' ),
);
?>
<input type="hidden" name="whatever" value="2" />
AND use
<?php
$value = array();
if( isset($_POST['whatever']) ) {
$value = isset($posibleValues[$_POST['whatever']]) ? $posibleValues[$_POST['whatever']] : array();
}
?>
Bookmarks