Studiati questo codice:
Codice PHP:
<?php $rand = substr(md5(microtime()), 0, 10); ?>
<form method="post">
<input type="hidden" name="rand" value="<?php echo($rand); ?>" />
Name: <input type="text" name="<?php echo($rand); ?>[name]" value="Mario" />
Surname: <input type="text" name="<?php echo($rand); ?>[surname]" value="Rosso" />
<input type="submit" />
</form>
<pre>
<?php
$fields = isset($_POST['rand']) && isset($_POST[$_POST['rand']]) ? $_POST[$_POST['rand']] : array();
print_r($fields);
?>
</pre>