Get the name of submit button in PHP

后端 未结 3 1046
粉色の甜心
粉色の甜心 2021-01-05 13:55

How do I get the name of the submit button in PHP?

I got the value of submit button, but I could not find any code to get the name of the button. Below is the code I

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-05 14:47

    You will find the name in the $_POST array.

    
    

    This way you will see everything in the $_POST array.

    You can iterate through the array with:

    foreach($_POST as $name => $content) { // Most people refer to $key => $value
       echo "The HTML name: $name 
    "; echo "The content of it: $content
    "; }

提交回复
热议问题