how to get post from same name textboxes in php

后端 未结 3 1803
半阙折子戏
半阙折子戏 2021-01-26 06:25

I have a form with multiple textboxes which are created dynamically, now all these textboxes are of same name lets say txt, now is there any way that when form proc

3条回答
  •  情歌与酒
    2021-01-26 06:53

    You have to name your textboxes txt[] so PHP creates a numerically indexed array for you:

     $value )
    {
      echo 'Textbox #'.htmlentities($key).' has this value: ';
      echo htmlentities($value);
    }
    
    ?>
    

    Otherwise the last textbox' value will overwrite all other values!

    You could also create associative arrays:

    
    
    
    

    But then you have to take care of the names yourself instead of letting PHP doing it.

提交回复
热议问题