It is not the correct way because $colors being an array, the HTML code for the hidden input element will look like this (once the HTML has been generated by PHP):
[code] <input type="hidden" name="colors" value="Array"> [/code] What you probably want to do instead is something like this: [code] <? foreach ($colors as $color) { ?> <input type="hidden" name="colors[]" value="<?= $color ?>"> <? } ?> // close loop [/code] This will create the following HTML (for the given example)... [code] <input type="hidden" name="colors[]" value="red"> <input type="hidden" name="colors[]" value="blue"> <input type="hidden" name="colors[]" value="green"> <input type="hidden" name="colors[]" value="yellow"> [/code] ... and File2.php will do its job as desired. Shaunak > -----Original Message----- > From: Imran Asghar [mailto:[EMAIL PROTECTED] > Sent: Wednesday, February 11, 2004 3:17 PM > To: [EMAIL PROTECTED] > Subject: [PHP] array data > > > Hi, > > Is not working, is it correct way???? > > File1.php > <? $colors = array('red','blue','green','yellow'); ?> > <form action="file2.php" method="post"> > <input type="hidden" type" name="colors" value="<?=$colors?>"> > </fomr> > > File2.php > > <? > echo $colors[0]; > echo $colors[1]; > echo $colors[2]; > echo $colors[4]; > ?> > > > > imee > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php