URL

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Shelly

    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?var 1=something&var 2=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?var 1=something&var 2=somethingelse
    or
    http:/www.foo.com?var 1=something&var 2=somethingelse again

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

    Thanks.

    Shelly


  • Janwillem Borleffs

    #2
    Re: URL

    Shelly wrote:[color=blue]
    > I have tried $txt1, $_POST['txt1'] and $_GET['txt1']. What I want
    > to generate is a URL of either
    >
    > http:/www.foo.com?var 1=something&var 2=somethingelse
    > or
    > http:/www.foo.com?var 1=something&var 2=somethingelse again
    >
    > depending upon whether or not txt1 is empty and I want to do this
    > within the <body></body> section.
    >[/color]

    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


    Comment

    Working...