将表单提交到php文件中的特定函数

So I have a form in index.php

  <? requireonce("action.php"); ?>
  <form action="action.php" method="post">
    //stuff
  </form>

I also have a function to handle that form in action.php

<? 
   function formHandle(){
      //stuff
   }
?>

How do I pass the form to formHandle() entirely within index.php? I don't want to call formHandle() in action.php because it's required in index.php - and I don't want it to run upon page opening.

You can do so in action.php

<?php

if(isset($_POST['myform'])){

formHandle();  // call to a function
}

?>

Change your action to index.php and call formHandle from within index.php.

<? require_once("action.php"); ?>
<form action="index.php" method="post">
    //stuff
</form>

You cannot submit "to a function". Browsers don't care about server-side languages. Browsers communicate via HTTP. HTTP has no concept of "functions" or specific programming languages. You submit something to a URL, and the server handles whatever happens at that URL.