How to Get the multiple radio buttons values in PHP which having names dynamically

前端 未结 4 2248
不思量自难忘°
不思量自难忘° 2021-02-09 06:17

I am having following codings in my form..how do I get the value of all radio button values on submit which is inside looping? Or give me any other solution for this.



        
4条回答
  •  梦毁少年i
    2021-02-09 07:02

    Use array of radio button as follows

    Questions?

    To access the posted values, you can simply use $_POST['optradio']

    Considering the selection for 5 questions to be Option 1, Option 2, Option 3, Option 1, Option 2 POST['optradio'] will give array like

    Array ( [1] => a [2] => b [3] => c [4] => a [5] => b )

    To access sigle values from this array, you can use foreach loop as,

     $option_val)
        echo $option_num." ".$option_val."
    "; ?>

提交回复
热议问题