HTML question

Rallispec

Lifer
Jul 26, 2001
12,375
10
81
i feel kinda dumb asking this becuase this is the exact same thing i did almost everyday last summer at my old job--

I'm making an online registration form for my companies website... however the form is too long to be reasonable put on one page-- so im splitting it up over two pages.

all i want to do is make it so that when you press the 'continue' button on the first page, it sends the variables from that page to the next page through the URL (ie: ?var=var1). I dont remember how to make it do that though... and once i do that, i dont remember how to make sure the next page is able to use them.
 

Czar

Lifer
Oct 9, 1999
28,510
0
0
through the command line? what are you using, dos? ;)


you could either put the varibles in the session space on the server or you could do it like this

index.php?var1=harhar&var2=hawhaw
 

Rallispec

Lifer
Jul 26, 2001
12,375
10
81
Originally posted by: Czar
through the command line? what are you using, dos? ;)


you could either put the varibles in the session space on the server or you could do it like this

index.php?var1=harhar&var2=hawhaw

hahaha


okay.. its early.. sorry- my brain hasnt turned on yet.. not the command line.. through the URL.. you know what i meant.
 

Rallispec

Lifer
Jul 26, 2001
12,375
10
81
its starting to come back to me..

my main question now is on the second page.. do i have to initialize or set the variable i passed?
or can i just start using them right away as what i sent them as?
 

Czar

Lifer
Oct 9, 1999
28,510
0
0
you should be able to use them right away, though I know with php you have to enable it in php.ini
 

Rallispec

Lifer
Jul 26, 2001
12,375
10
81
okay..

thanks czar!

i dont know how i forgot that.. its a lot easier than i remembered
 

Rallispec

Lifer
Jul 26, 2001
12,375
10
81
okay.. new problem

<FORM ACTION="page2.html?name=var1&title=var2" METHOD=" ">


what do i put as the method? i had it set to post, but it didnt work.
 

FeathersMcGraw

Diamond Member
Oct 17, 2001
4,041
1
0
Originally posted by: Rallispec
okay.. new problem

<FORM ACTION="page2.html?name=var1&title=var2" METHOD=" ">

what do i put as the method? i had it set to post, but it didnt work.

GET sends information encoded in the URL. POST sends it directly as part of the HTTP request.
 

Czar

Lifer
Oct 9, 1999
28,510
0
0
Originally posted by: FeathersMcGraw
Originally posted by: Rallispec
okay.. new problem

<FORM ACTION="page2.html?name=var1&title=var2" METHOD=" ">

what do i put as the method? i had it set to post, but it didnt work.

GET sends information encoded in the URL. POST sends it directly as part of the HTTP request.
ah right :)
 

Rallispec

Lifer
Jul 26, 2001
12,375
10
81
okay.. so now i have it sending to the second page just fine...

but when i hit the submit button on the second page.. it only submitse the info from the second page
 

FeathersMcGraw

Diamond Member
Oct 17, 2001
4,041
1
0
Originally posted by: Rallispec
okay.. so now i have it sending to the second page just fine...

but when i hit the submit button on the second page.. it only submitse the info from the second page

Declare INPUT TYPE="hidden" for all the variables you're passing from one page to the next. I'm guessing if you don't include VALUE attributes, they'll be initialized by the values you receive as part of the GET request.
 

Czar

Lifer
Oct 9, 1999
28,510
0
0
the form only sends what is within the <form> tags, you have to use hidden fields that contain the varibles in the url
 

Rallispec

Lifer
Jul 26, 2001
12,375
10
81
Originally posted by: Czar
the form only sends what is within the <form> tags, you have to use hidden fields that contain the varibles in the url


hmm.. still not working

when i press 'continue' on the first page, everything looks okay. I see the variables in the URL fine.. so i'm assuming they go okay..



on the second page i have this in the code:

<FORM ACTION="/cgi-bin/cgiemail/nvtc/reg.txt" METHOD="post">

<INPUT TYPE="hidden" name="educatorname">

...... more variables...

<input type="submit" value="Register"> (submit registration button)


the variable educatorname is one of the varaibles passed from page 1

when i hit submit on page 2, the the automatic registration email sends fine-- however all the information collected from page 1 still comes up blank.
 

Czar

Lifer
Oct 9, 1999
28,510
0
0
not sure how to do this with just html, I think you would have to go somewhere in server side scripting

like

print("<input type=hidden name=something value=".$varinurl." />);
 

Rallispec

Lifer
Jul 26, 2001
12,375
10
81
okay how would i do this

say i want too automatically fill out a text box on page two with info collected from page one


<INPUT TYPE="text" name="email" value=????>



 

FeathersMcGraw

Diamond Member
Oct 17, 2001
4,041
1
0
Originally posted by: Rallispec

when i hit submit on page 2, the the automatic registration email sends fine-- however all the information collected from page 1 still comes up blank.

Then you'll need to initialize the values in the hidden fields to the corresponding values you received from the first form. If the second page is a static HTML page, you'll need to do this with a client-side language like Javascript or VBscript. If you're generating the second page dynamically (ASP/JSP/CGI), then you'll need to output the INPUT TYPE="hidden" elements with VALUE attributes set to the values that you want to pass on.
 

Rallispec

Lifer
Jul 26, 2001
12,375
10
81
okay... javascript is where i fail.. used to know some vb.. but not anymore.



okay, so say right now the only variable i'm worried about is "educatorname"

is this going to just be one line of script like Czar wrote? or is their more to it?
 

FeathersMcGraw

Diamond Member
Oct 17, 2001
4,041
1
0
Originally posted by: Rallispec
okay... javascript is where i fail.. used to know some vb.. but not anymore.



okay, so say right now the only variable i'm worried about is "educatorname"

is this going to just be one line of script like Czar wrote? or is their more to it?

If you have access to the variables in the request URL via some sort of Request object, it's a one-liner. Otherwise, you're going to have to parse the URL, extract the variable you're interested in, and decode the contents if they've been encoded (spaces translated into %20, for example).

At this point, I'd say the easiest course of action would be to collapse the form onto a single page again, particularly if you're not using any dynamic page generation technologies. I was under the impression that Javascript had a Request object on the client side that could parse form data, but Czar might be right, and that may need to be done server side.
 

jjones

Lifer
Oct 9, 2001
15,424
2
0
I'm not positive about this because I've never had occasion to use it but if your server supports SSI you should be able to pass the variables and parse the page using the .shtml extension.