Retrieve post array values

后端 未结 6 1044
野的像风
野的像风 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 02:03

    I prefer foreach insted of for, because you do not need to heandle the size.

    if( isset( $_POST['qty'] ) )
    {
        $qty = $_POST ['qty'] ;
        if( is_array( $qty ) )
        {
            foreach ( $qty as $key => $value ) 
            {
                print( $value );
            }
        }
    }
    

提交回复
热议问题