468,315 Members | 1,442 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,315 developers. It's quick & easy.

URL

This is probably very simple, but I can't seem to figure it out.

If we have straight html and a form with method="GET",
action="http:/www.foo.com", and hidden variables of var1 and var2 with
values, the submit button results in a URL of

http:/www.foo.com?var1=something&var2=somethingelse.

What I want to do is have this be a php page and have a conditional
statement in there that sets the value of var2. That is also no problem,
except I want this condition to be based upon whether text field txt1 is
empty or has information put in there by the user. I cannot figure out how
to reference the text fiels txt1 in order to formulate the test.

I have tried $txt1, $_POST['txt1'] and $_GET['txt1']. What I want to
generate is a URL of either

http:/www.foo.com?var1=something&var2=somethingelse
or
http:/www.foo.com?var1=something&var2=somethingelseagain

depending upon whether or not txt1 is empty and I want to do this within the
<body></body> section.

Thanks.

Shelly
Apr 26 '06 #1
1 1030
Shelly wrote:
I have tried $txt1, $_POST['txt1'] and $_GET['txt1']. What I want
to generate is a URL of either

http:/www.foo.com?var1=something&var2=somethingelse
or
http:/www.foo.com?var1=something&var2=somethingelseagain

depending upon whether or not txt1 is empty and I want to do this
within the <body></body> section.


When you want to react on what the user has entered in the text1 input field
(I assume this is an input field) before the info is submitted to the
server, PHP can't help you and you will have to resort to some client-side
technique, like JavaScript.
JW
Apr 26 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by William C. White | last post: by
2 posts views Thread by Albert Ahtenberg | last post: by
3 posts views Thread by James | last post: by
reply views Thread by Ollivier Robert | last post: by
1 post views Thread by Richard Galli | last post: by
4 posts views Thread by Albert Ahtenberg | last post: by
1 post views Thread by inderjit S Gabrie | last post: by
2 posts views Thread by Jack | last post: by
3 posts views Thread by Sandwick | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.