Submit form to action php file

后端 未结 3 1185
长情又很酷
长情又很酷 2021-01-15 12:09

I have a form where when the user clicks submit, I need a php file to be ran. below is the form and the php file.

3条回答
  •  花落未央
    2021-01-15 12:44

    A couple of things:

    • you're using $_GET instead of $_POST
    • isset($_POST['submit']) is not a good check, not every browser will send the submit button in its request. (Apart from the fact that you haven't even named the submit button, so it wouldn't come through in any browser, as it stands now.)
    • it's better to use:

    Code:

    if($_SERVER['REQUEST_METHOD'] == 'POST')
    {
    
    }
    

提交回复
热议问题