Retrieve post array values

后端 未结 6 1100
野的像风
野的像风 2021-01-13 01:23

I have a form that sends all the data with jQuery .serialize() In the form are four arrays qty[], etc it send the form data to a sendMail page and

6条回答
  •  情书的邮戳
    2021-01-13 01:51

    try using filter_input() with filters FILTER_SANITIZE_SPECIAL_CHARS and FILTER_REQUIRE_ARRAY as shown

    $qty=filter_input(INPUT_POST, 'qty',FILTER_SANITIZE_SPECIAL_CHARS,FILTER_REQUIRE_ARRAY);
    

    then you can iterate through it nicely as

    foreach($qty as $key=>$value){
        echo $value . "
    "; }

提交回复
热议问题