PHP | Get input name through $_POST[]

前端 未结 8 1558
长发绾君心
长发绾君心 2020-12-16 19:10

HTML example:

  
8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-16 20:09

    You can use a foreach Loop to get all values that are set.

    foreach ($_POST AS $k=>$v){
        echo "$k is $v";
    }
    

    Your example

    echo $_POST['email'].name; //output: email
    

    wouldnt make sense, since you already know the name of the value you are accessing?

提交回复
热议问题