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

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 :(
  • Comment on Re^2: how can i take value in TextBox and pass to a URL?

Replies are listed 'Best First'.
Re^3: how can i take value in TextBox and pass to a URL?
by scorpio17 (Canon) on Dec 11, 2009 at 14:58 UTC

    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
Re^3: how can i take value in TextBox and pass to a URL?
by blackcode (Novice) on Dec 10, 2009 at 21:11 UTC
    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.