Results 1 to 3 of 3

Thread: append form entry to URL

  1. #1
    Join Date
    Oct 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question append form entry to URL

    Hey,

    I need some help...

    I want to create one text field and when a user enters a number in that field I want it to append that number onto the URL.

    E.G

    If the webpage is www.example.com and the user enters 111 into the text field, when they click submit I want it to send them to www.example.com/111

    Any help would be greatly appreciated

    Thanks

  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="noscript.html" onsubmit="this.action = '/' + this.elements.num.value;">
      <input type="text" name="num">
      <input type="submit">
    </form>
    Ideally, you'd submit the form to a server-side script, which would then display the appropriate content.
    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
    Oct 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks, works great

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
  •