问题描述:

This question already has an answer here:

  • How to place two forms on the same page?

    4 answers

网友答案:

As per comment below, its better to have a named submit button element within the form.

<form name="form" action="<?php echo __FILE__ ?>" method="POST">
  <input name="form1" type="submit" value="Submit">
</form>


<?php
  if(isset($_POST['form1'])){ 
    var_dump($_POST);
  }
?>

Since I've been using nothing but ajax requests I didn't really run into the issue but using a name in the form is possible using jQuery as well.

However I'm quite sure there are mutliple answers spread around stackoverflow so next time search a little bit better.

网友答案:

HTML

<form name="form1" action="/url" method="POST">

</form>

PHP

if (isset($_POST["form1"])) {
 // ...
}
相关阅读:
Top