1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Submiting a simple form using PHP and jquery

Discussion in 'PHP' started by asgsoft, Jan 16, 2016.

  1. #1
    Hey guys,

    Hope everyone's doing well!

    So I have a simple form which I am trying to submit using simple POST attribute.

    The form (codepen.io code here) design features some jquery to move from one question to another.

    What I would like is ideally is a <button> tag (for the sake of keeping CSS styling) that would submit the form just like an <input> and physically rediredct the user to s1proc.php where the input would be processed.

    Can you please help me achieve that?

    Thank you very much in advance :)
    SEMrush
     
    asgsoft, Jan 16, 2016 IP
    SEMrush
  2. KangBroke

    KangBroke Notable Member

    Messages:
    1,025
    Likes Received:
    58
    Best Answers:
    4
    Trophy Points:
    215
    #2

    If all your asking for is how to use the <button> tag you can find the documentation here ->http://www.w3schools.com/tags/att_button_form.asp

    And you would just alter the form to suit your needs similar to the code below


     <form action="s1proc.php" method="post" id="form1">
      First name: <input type="text" name="fname"><br>
      Last name: <input type="text" name="lname"><br>
    </form>
    
    <button type="submit" form="form1" value="Submit">Submit</button> 
    HTML:
     
    KangBroke, Jan 16, 2016 IP
  3. asgsoft

    asgsoft Well-Known Member

    Messages:
    1,737
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    160
    #3
    Thank you for your response. The issue I am having with that is the button doesn't actually submit the form but rather moves onto a blank page (without redirecting away from the actual URL/form page)
     
    asgsoft, Jan 16, 2016 IP
  4. KangBroke

    KangBroke Notable Member

    Messages:
    1,025
    Likes Received:
    58
    Best Answers:
    4
    Trophy Points:
    215
    #4
    Let us see the code your attempting to use because it should work as shown above.
     
    KangBroke, Jan 16, 2016 IP
  5. asgsoft

    asgsoft Well-Known Member

    Messages:
    1,737
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    160
    #5
    asgsoft, Jan 16, 2016 IP
  6. KangBroke

    KangBroke Notable Member

    Messages:
    1,025
    Likes Received:
    58
    Best Answers:
    4
    Trophy Points:
    215
    #6
    Gotcha, I thought you were asking much easier question. Now I think that what your asking is after step 8 to send to url.
     
    Last edited: Jan 16, 2016
    KangBroke, Jan 16, 2016 IP
  7. KangBroke

    KangBroke Notable Member

    Messages:
    1,025
    Likes Received:
    58
    Best Answers:
    4
    Trophy Points:
    215
    #7
    This should have been posted in JavaScript/jQuery not PHP.
     
    Last edited: Jan 16, 2016
    KangBroke, Jan 16, 2016 IP
  8. asgsoft

    asgsoft Well-Known Member

    Messages:
    1,737
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    160
    #8
    thanks for the advice. Will repost there :)
     
    asgsoft, Jan 17, 2016 IP