|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Passing values into an array
Hi, is there a simple and easy way of passing values from page A into specified arrays on page B? Eg, $somevariable from one page is passed either by GET or POST into $somearray[somevalue] on page B. Better yet, I don't want to have to edit page B to do something like $somearray[somevalue]=$somevalue.
Any luck for me? ![]() |
|
#2
|
|||
|
|||
|
is what your trying to say is that you want to send an array to a another page, as an array?
|
|
#3
|
|||
|
|||
|
store it in a session variable, or serialize it and pass it in the querystring
|
|
#4
|
|||
|
|||
|
Quote:
|
|
#5
|
|||
|
|||
|
what i meant to say was, serialize THEn store in a session variable or querystring. sessions are easy!
PHP Code:
|
|
#6
|
|||
|
|||
|
this is what i would do.
$array = array('value1', 'value1', 'value2', 'value3', 'value4'); $data = implode(",", $array); //$data = "value1,value1,value2,value3,value4"; then you can send that via a link, or in a hidden form field, etc once you goto the next page, sending $data to it, the you use the following exampel $array = explode(",", $_GET['data']); the url submitted would look something like fil.php?data = value1,value1,value2,value3,value4 |
|
#7
|
|||
|
|||
|
Thanks guys, I *think* I know what I'm doing now
![]() |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Passing values into an array |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|