Manipulating a form field with your URL?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Angry Jew Cat - Banned for Life
    (felis madjewicus)
    • Jul 2006
    • 20368

    #1

    Manipulating a form field with your URL?

    Ok, say I have a signup form with a few text input fields and a submit button. Is it possible without any uber-fancy script or code to manipulate the input to one of those fields via the URL, to create a sort of referal link?
  • mikeyddddd
    Viva la vulva!
    • Mar 2003
    • 16557

    #2
    [Your URL]?id=your_value

    Using PHP:

    <INPUT TYPE=submit value=\"$id\">


    Using Javascript something like:

    Code:
    id = location.href.substring(location.href.lastIndexOf(' '),location.href.lastIndexOf('id=')+3);
    would find the field value for id

    then use a javascript write to the value into the form:

    Code:
    <input type=submit value="<script language="JavaScript">document.write(id);</script>">

    Comment

    • skinnay
      Confirmed User
      • Apr 2004
      • 2274

      #3
      make sure you do some input validation while you're at it
      Make Real Green with ORGANIC SEO | Blog post exchange | Non-index page trades | A-B C-D Trades [icq: 194-215-962] [mail: [email protected]]

      Comment

      • seeandsee
        Check SIG!
        • Mar 2006
        • 50945

        #4
        I want to learn php
        BUY MY SIG - 50$/Year

        Contact here

        Comment

        Working...