Transferring Variables

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Wacko2019
New php-forum User
New php-forum User
Posts: 16
Joined: Sun Oct 27, 2002 10:18 am
Location: Netherlands

Transferring Variables

Postby Wacko2019 » Fri Nov 01, 2002 2:21 am

Hello everybody,

I have a problem with transferring variables from page to page.

I'm developing a database add form wich contains about 6 web pages. As we all know, you can read out variables from a previous web page containing a form, but if you go from there to te next page, you lose them again. To deal with this problem, I've inserted hidden fields on every webpage:
<input type="hidden" name="name" value="<? echo "$name"; ?>">
So the variables would be passed on from field to field.

When I reach the last page, I show all the variables inserted by the user over the 6 pages and the variables will be added into the database.

Because this is very complicated and doesn't always work, my question is, isn't there an easyer (better) way to do this?

Greetz Helgo Rongen

DoppyNL

Postby DoppyNL » Fri Nov 01, 2002 2:43 am

You can use Get-variables (add them to the url), that way you can also use normal links to proceed to the next page.

you can also use sessions and store the data in the session.

Greetz Daan

Wacko2019
New php-forum User
New php-forum User
Posts: 16
Joined: Sun Oct 27, 2002 10:18 am
Location: Netherlands

Postby Wacko2019 » Fri Nov 01, 2002 2:57 am

Hmmzz, I thought about adding them to the url, but I have a maximum of more than 100 variables........en it depends on what is added, because not every field is obligated to be filled out. Also, on some pages, you have the possibility to add a number of "things" all at once.

For instance: you're accommodation has 12 rooms, so you type in the field 12, en you get 12 fields with there own attributes.

Never the less, the idea of sessions sounds good to me, could you explain how this works???

Greetz Helgo.

DoppyNL

Postby DoppyNL » Fri Nov 01, 2002 3:34 am

http://nl.php.net/manual/nl/ref.session.php
on that page sessions in php are explained, its a LOT of info, but usefull.
The needed/available functions are located somewhere at the bottem of the page.

Greetz Daan

Wacko2019
New php-forum User
New php-forum User
Posts: 16
Joined: Sun Oct 27, 2002 10:18 am
Location: Netherlands

Postby Wacko2019 » Fri Nov 01, 2002 3:48 am

Tnx for the valuable information..........I'll check it out.

Greetz Helgo.


Return to “PHP coding => General”

Who is online

Users browsing this forum: Google [Bot], krotbacca and 1 guest