|
Posted by Shelly on 07/24/05 14:27
<opt_inf_env@yahoo.com> wrote in message
news:1122202838.611526.302440@o13g2000cwo.googlegroups.com...
> Hello,
>
> I know three ways to pass variables form one page to another. The first
> one is to declare and set session variable.
Assuming that you have session_start() at the beginning of both pages?
> In this case if one goes to
> another page (by clicking on hyperlink or pressing a button) value of a
> session variable will be automatically seen on the new page. The second
> way is to set hidden variables in the form and go to new page by
> execution of this form (press a button or enter),
???? Hitting the enter button will only have variables on that page unless
you do what you call the first or third methods. What do you mean here?
> and the last way,
> which I know, is in the declaration of hyperlink after name of a new
> page put after "?" names and values of variables. Sometimes I need
> to use the third way. However I do not like that after new page is
> loaded in the address line of browser one can see all variables (names
> and values). Can one avoid this problem?
Yes. Create a variable which is an array. Put in the values you want for
each variable as:
theArray['first_var'] = first value;
Then create a single session variable which is $_SESSION['theValues'] =
$theArray and pass that single array via the ?thevalues = $theArray.
At the other end you say:
theArrayReceived = $_GET['thevalues'];
and you have an array that you can get the values via the indexing.
I haven't tried it, but it might also work without the creation of the
session variable step. IOW, say
?thevalues=theArray; and on the other end say theArrayReceived=
$_GET['thevalues'];
When I get home from vacation, I will try it. If you try this and it works
without the session variable step, please let me know.
Shelly
Navigation:
[Reply to this message]
|