Unanswered: Form Inputs with Same Name - Beahvior ?
Hi, everyone! Lil' help, please.
I'm migrating from ASP to PHP, and a lot of my work with forms in ASP was based on the behavior of input fields that have the same name. When that happens, the field value is concatenated with commas. For example:
Now what I noticed in PHP is that if there are two or more input fields with the same name, the next will overwrite the prior, or the value will always be the last one (not too sure). Is that the expected behavior? Any way to change it or to work around it?
I just wanted to add that I know about using brackets in the form element name. It's just that using brackets there is gonna cause me so much trouble, I really didn't want to handle it like that. What I meant to ask is, is there another way ?
PHP requires an array. I don't know why php cannot access the coma-concatenated data, because that is produced by the browser no matter what type of form processing code there is.
If you want a same-name variable, you will need to use one of the following methods:
or specifically indexed -
or unique names -