Results 1 to 4 of 4

Thread: Form redirects based on input

  1. #1
    Join Date
    May 2005
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Form redirects based on input

    Hey

    Is it possible to have this script

    http://www.irt.org/script/1558.htm

    but with just one input box instead of one for each query

    Cheers

    gold2040

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Code:
    <form action="default.cgi" onsubmit="
    if (this.elements['box1'].value != '') this.action == 'box1.cgi';
    else { alert('Please fill something in'); return false; }
    return true;">
    <input type="text" name="box1">
    </form>
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    May 2005
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hey Twey

    Thanks, but what I meant was say you put for example

    javascript
    Perl language
    PHP
    ASP Scripts

    as queries

    Would it be possible depending on what query you typed in to redirect to a different webpage with just 1 input box instead of having a box for each query.

    Cheers if possible

    gold2040
    Last edited by gold2040; 11-20-2005 at 12:17 PM.

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Ah, I see. Yes.
    Code:
    <form action="default.cgi" onsubmit="
    var ve = this.elements['box1'].value.toLowerCase();
    if (this.elements['box1'].value != '') {
      if(ve == "javascript") this.action == 'box1.cgi';
      else if(ve == "java") this.action == 'box2.cgi';
      else if(ve == "php") this.action == 'box3.cgi';
    }
    return true;">
    <input type="text" name="box1">
    </form>
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •