Can I put associative arrays in form inputs to be processed in PHP?

后端 未结 3 989
栀梦
栀梦 2021-01-17 07:53

I know I can do things like , but is it possible to do things like and have it show up

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-17 08:50

    Let say we want to print student scores using the form below:

    and PHP code to print their scores:

    if(isset($_POST['submit']))
    {
        echo $_POST['student']['john'] . '
    '; echo $_POST['student']['kofi'] . '
    '; echo $_POST['student']['kwame'] . '
    '; }

    This will print the values you input into the field.

提交回复
热议问题