Newbie forms question

Status
Not open for further replies.

svdsinner

Ars Legatus Legionis
15,152
Subscriptor
Ok, I'm on a very time-limited quest to become fluent in Web-app writing. I need to crank out in a few days time a non-secure, non-bug free, non-feature complete rough draft of a proposed web app. (Just to show others what it will eventually do.)

Our typical web gurus are on vacation, so I'm the man, and I've done very, very little with .html. (I know some C++, Fortran, Pascal, etc., but very little web stuff.)

For this rough draft, I'll be using PHP for processing, a cheesy ODBC conection to an access database, and a HTML forms to pass data between pages.

I know how to create a user filled out form that one page will pass to another like this:

[User inputs Data on this page]
|
|
V
[The very next page uses the Data the user entered]

What I don't know is the syntax to continue passing the data onto subsiquent web pages. Example:

[User inputs Data on this page]
|
|
V
[The very next page uses the Data the user entered]
|
|
V
[The next page can still use the Data the user entered 2 pages back]

I know I could probably set a cookie, and then keep reading it, but that would be so amazingly gay that I'd feel guilty doing something like that for a rough draft.

Can anyone help me with this? My time is limited, so a code example would help me a lot.
 

Iconoplast

Ars Scholae Palatinae
1,040
A few possibilites are available. Besides cookies, you can pass the data through forms, sessions, or just through the URL. With the first solution you'll be continually submitting forms which may be inconvienient depending on what you're doing. If you pass them through the URL, you'll get long URLs that you have to manage to keep the variables in place. Probably the best solution is to use sessions. Sessions keep a set of variables associated with your connection on the server. The PHP manual has a section that should explain their usage pretty well.
 

sroylance

Ars Tribunus Militum
2,156
Perl's CGI.pm does something like this automatically. It makes all widgets 'sticky'. Basically, when you use CGI.pm to print a textfield widget with a command like textfield("first_name") it looks in the parameters that were passed in to the script, and if there is a value for first_name, it fills the textfield in with it. It makes it look like the widget maintains its value acrosss calls to the script. You lose all the persistence if the user goes to another page, however.
 
Status
Not open for further replies.