Results 1 to 2 of 2

Thread: dynamic link

  1. #1
    Join Date
    Jul 2005
    Location
    New Jersey
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question dynamic link

    I made a form on a website that I am creating. How would I make it so that the text field that the user enters into adds into the link? I have given the coding for my form:

    Code:
               <form action="http://maps.google.com/maps" method="get">
                  <p> 
                    <label for="saddr">Your Address</label>
                    <input type="text" name="saddr" id="saddr" value="" />
                    <input name="Submit" type="submit" value="Get Directions" target="_new" onClick="return frameBranding('http://maps.google.com/maps?saddr=' + saddr.text + '&daddr=744+Broad+Street+Newark+NJ', 'brand.htm', 'rows');"/>
                    <input type="hidden" name="daddr" value="744 Broad Street Newark, NJ" />
                    <input type="hidden" name="hl" value="en" />
                  </p>
                </form>

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

    Default

    What's this frameBranding() thing? And... what link? There's almost certainly no reason to fall back onto ECMAScript here. If you just want to go to http://maps.google.com/maps?saddr=(stuff)&daddr=744+Broad+Street+Newark+NJ, there's an easier way:
    Code:
               <form action="http://maps.google.com/maps" target="_new" method="get">
                  <p> 
                    <label for="saddr">Your Address</label>
                    <input type="text" name="saddr" id="saddr" value="" />
                    <input name="Submit" type="submit" value="Get Directions" />
                    <input type="hidden" name="daddr" value="744 Broad Street Newark, NJ" />
                    <input type="hidden" name="hl" value="en" />
                  </p>
                </form>
    That's what GET encoding is all about.
    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
  •