Submit form using only PHP? Without JavaScript?

后端 未结 5 1101
故里飘歌
故里飘歌 2021-01-26 10:50

I have a form

相关标签:
5条回答
  • 2021-01-26 11:29

    A form must be submit, by the client side. On client-side, there's only two way: by Javascript or by human (clicking on the submit button).

    0 讨论(0)
  • 2021-01-26 11:30

    The act of form submission is done on the client side (browser) and has very little to do with PHP (server side).

    You could add a submit button like <input type='submit' value='click here to complete step' />

    0 讨论(0)
  • 2021-01-26 11:35

    Unfortunately, what you are trying to do is not possible. The best you can do is probably this:

    <form method='post' action='action.php' name='myForm'>
        <input type='' name='id' value='id'>
        <input type='submit' id='submit-button' />
        <script>domument.getElementByID('submit-button').style.display="none";document.myForm.submit();</script>
    </form>
    

    A submit button is displayed when client side scripting is disabled. When it's enabled, the submit button is immediately hidden and the form is automatically submitted.

    EDIT

    Or you could simply include the PHP file. <?php include action.php; ?>. You won't have access to the _POST array, but considering, the client hasn't had chance to enter any data, that won't really matter.

    0 讨论(0)
  • 2021-01-26 11:43

    add a submit button.

    <input type="submit" value="Submit" />
    
    0 讨论(0)
  • 2021-01-26 11:44

    Why not just use the <input type="submit" /> like the following:

    <form method='post' action='action.php' name='myForm'>
      <input type='text' name='id' value='id' />
      <input type='submit' name='submission' value='Submit id'>
    </form>
    
    0 讨论(0)
提交回复
热议问题