Is there any way to submit a form in php without using the submit button?

Discussion in 'PHP' started by phpdeveloperindia, May 9, 2012.

  1. #1
    Is there any way to submit a form in php without using the submit button?
     
    phpdeveloperindia, May 9, 2012 IP
  2. PK-Host

    PK-Host Guest

    Messages:
    109
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    0
    #2
    You want to be looking into Ajax/Javascript PHP processes the form at the other end, it doesn't submit it.
     
    PK-Host, May 9, 2012 IP
  3. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #3
    I would opt for a premade javascript library if you go down this route. jQuery, prototype and mootools are all very well developed and will save you a bunch of time trying to implement your own ajax functionality.
     
    jestep, May 9, 2012 IP
  4. downloadphpscripts

    downloadphpscripts Peon

    Messages:
    21
    Likes Received:
    1
    Best Answers:
    3
    Trophy Points:
    0
    #4
    Hi there, are you by chance just looking for a way to submit the form without using a button? If so, you could use javascript to submit it. For example, if you gave your form an id, then you could use the onclick event handler to submit the form... like so:

    <form id="myform" action="whatever.php" method="post">
    <!-- your form fields here -->
    <input type="submit" style="display:none;" value="invisible_sumbit" />
    </form>
    HTML:
    Then, you would add an onclick event to a link, div, or whatever you like:

    <a href="javascript:void();" onclick="document.getElementById('myform').submit();">Submit Link</a>
    HTML:
    Hope that helps.
     
    downloadphpscripts, May 9, 2012 IP
  5. Alex Roxon

    Alex Roxon Active Member

    Messages:
    424
    Likes Received:
    11
    Best Answers:
    7
    Trophy Points:
    80
    #5
    If nobody has answered your question, you should perhaps clarify specifically what action you want to trigger the submit ;)
     
    Alex Roxon, May 10, 2012 IP
  6. netcommlabs

    netcommlabs Peon

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Yes you can submit form by using javascript onclick events.
     
    netcommlabs, May 10, 2012 IP