Forum Moderators: coopster
<input type="hidden" name="x[]" value="1">
<input type="hidden" name="x[]" value="2">
<input type="hidden" name="x[]" value="3">
are you sure that you don't need what eelix posted?
<form name="form1" method="post" action="c.php">
<input type="hidden" name="x[]" value="1">
<input type="hidden" name="x[]" value="2">
<input type="hidden" name="x[]" value="3">
<input type="submit" name="Submit" value="送出">
</form>
if not then you may need to add some more info
do you need to build the form from an array of values?
<?
$thearray = array("1"=>1,"2"=>2,"3"=>3));
$thestring = implode('-',$thearray);
?>
<form name="form1" method="post" action="c.php">
<input type="hidden" name="x" value=" <? echo $thestring; ?>">
<input type="submit" name="Submit" value="送出">
then
$thearray = explode('-',$_POST['x'];
print_r($thearray);
should work, didn't test it
serialize() [php.net]
The following will add the proper data to the hidden input field:
<form name="form1" method="post" action="c.php">
<?php
$array = array('one','two','three');
printf('<input type="hidden" name="x" value="%s" />', [url=http://www.php.net/htmlentities]htmlentities[/url]([url=http://www.php.net/serialize]serialize[/url]($array)));
?>
<input type="submit" name="Submit" value="送出">
And then on c.php, your action page, you are going to have to get the data back in the following way:
$theArray = [url=http://www.php.net/unserialize]unserialize[/url]([url=http://www.php.net/html-entity-decode]html_entity_decode[/url]($_POST['x']));
echo '<pre>'; [url=http://www.php.net/var-dump]var_dump[/url]($theArray); echo '</pre>';