in reply to how can i take value in TextBox and pass to a URL?

Something like this, maybe?

<html> <body> <form method="get" action="http://site.com/index.php"> <input type="text" name=""><br> <input type="hidden" name="more" value="whatever"> <input type="submit" value="Button-A"> </form> <br> <form method="get" action="http://site2.com/page.php"> <input type="hidden" name="" value="hello"> <input type="hidden" name="more" value="whatever"> <input type="submit" value="Button-B"> </form> </body> </html>

Note that using name="" is considered bad form, but if you change it to something like name="mytext" the URL you request will change to:
"http://site.com/index.php?mytext=heybuddy?more=whatever"

Replies are listed 'Best First'.
Re^2: how can i take value in TextBox and pass to a URL?
by blackcode (Novice) on Dec 10, 2009 at 21:09 UTC
    Hi <form method="get" action="http://site.com/index.php"> <input type="text" name="">
    <input type="hidden" name="more" value="whatever"> <input type="submit" value="Button-A"> ^ this part works fine, But the second form cannot take values from the textbox of the first form is the problem :(

      You want the value in the text box transmitted when EITHER button is clicked, not just the first? I guess I misunderstood the problem.

      Here's another trick you can use: just have one form, but use two submit buttons:

      <input type="submit" name="submit" value="ButtonA"><br> <input type="submit" name="submit" value="ButtonB"><br>

      Then your CGI script can check the value of the submit button, and branch accordingly. In your case, I suppose you'd simply do a redirect to the URL you want.

        Yes correct. TEXTBOX value should be forwarded to different URLs depending on

        1. Which button is clicked (Button-A or Button-B)

        or if user hits {ENTER} it should always pass the {TEXTBOX VALUE} to the URL assigned to Button-A. if no input is available and hit {ENTER} or clicked on either button, nothing should happen!

        URL for each button will be like

        Button-A: site.com/index.php?script={TEXTBOX VALUE}&first?=method

        Button-B: site2.com/index.php?script={TEXTBOX VALUE}&other?=ways

        Thank you all for your suggestions and great helps. I am not into programming side, therefore developing even a simple script as this is tough job. It shall be a great help if a server side cgi script also could be provided! Thanks alot for the help!

        any help friends?? i v no clue where to start where to end
      And, yes, I currently am using Javascript for this purpose. But the reason i am reluctant to go ahead with Java is since Java is depends on if its installed or not. That's why i thought using PERL/CGI may solve the problem. Regards John

        Are you confusing Javascript with Java? They are two different things.

        You seem to want a form that performs two different actions based on which button is clicked. For that you'll have to use Javascript, which is already present in most reasonable web browsers. There is no need to have Java installed.