Hi
I have an array of values and i am trying to send the array values with a hidden input field from a form to another script.How can this be done?
Code:
<input type=hidden name=array value="<?php echo $arrayname;?>">
I want to post the array values in another php page.Is this possible?
regards
geetha
http://www.codingcoding.com
http://www.lkjhgfdsa.org
Sending arrays with hidden input form field
Moderator: General Moderators
-
geethalakshmi
- Forum Commoner
- Posts: 31
- Joined: Thu Apr 24, 2008 10:38 pm
Sending arrays with hidden input form field
Last edited by geethalakshmi on Fri Jun 27, 2008 6:55 am, edited 1 time in total.
Re: What is PEAR?
Please use google next time, we're not here to spoon-feed you.
"PEAR is a framework and distribution system for reusable PHP components."
http://pear.php.net/
"PEAR is a framework and distribution system for reusable PHP components."
http://pear.php.net/
- andym01480
- Forum Contributor
- Posts: 390
- Joined: Wed Apr 19, 2006 5:01 pm
Re: Sending arrays with hidden input form field
Mods - what is going on? Why a reply to a different post above?
geethalakshmi - probably easiest to use a session to pass the array to the next script.
geethalakshmi - probably easiest to use a session to pass the array to the next script.
Code: Select all
session_start(); at the very top of the script before any browser output
$_SESSION['arrayname']=$arrayname; //puts the array into a an array in the sessionCode: Select all
//on the next script
session_start(); //at the very top before any browser output
$arrayname=$_SESSION['arrayname']; //to retrieve- jayshields
- DevNet Resident
- Posts: 1912
- Joined: Mon Aug 22, 2005 12:11 pm
- Location: Leeds/Manchester, England
Re: Sending arrays with hidden input form field
Or you could run a foreach, something like this:
Code: Select all
foreach($array as $a)
echo '<input type="hidden" name="array[]" value="' . $a . "' />';
Re: Sending arrays with hidden input form field
And it just happened to me in a way that makes me look like a jerkMods - what is going on? Why a reply to a different post above?