Need help with a simple PHP Script

Discussion in 'PHP' started by oseymour, Jul 26, 2007.

  1. #1
    I know nothing about PHP and I need help with a little script..

    I want a simple form where it asked for a name and a number and then when the user clicks submit it sends them to a url with includes the name and number

    example

    name : oral
    number: 221 221

    when I click submit it should send them to mysite.com?oral&221+221

    The + is important
     
    oseymour, Jul 26, 2007 IP
  2. lbalance

    lbalance Peon

    Messages:
    381
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #2
    you can do that with an html form with javascript.
     
    lbalance, Jul 26, 2007 IP
    oseymour likes this.
  3. oseymour

    oseymour Well-Known Member

    Messages:
    3,960
    Likes Received:
    92
    Best Answers:
    0
    Trophy Points:
    135
    #3
    do you have a link to a tutorial....

    I prefer php because I want to learn it in the future
     
    oseymour, Jul 26, 2007 IP
  4. personalpa

    personalpa Peon

    Messages:
    98
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
  5. oseymour

    oseymour Well-Known Member

    Messages:
    3,960
    Likes Received:
    92
    Best Answers:
    0
    Trophy Points:
    135
    #5
    oseymour, Jul 26, 2007 IP
  6. almighty

    almighty Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    it's called html get method, which the variable value will be sended to the url...
     
    almighty, Jul 26, 2007 IP
  7. Kylratix

    Kylratix Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    This should do it:
    
    <input id="number" name="number" />
    <input id="name" name="name" />
    <button onclick="document.location = 'http://www.mysite.com?' + document.getElementById('name').value + '&' + document.getElementById('number').value;">Go</button>
    HTML:
     
    Kylratix, Jul 26, 2007 IP