jquery - Put the value of every field with the same name attribute into an array using PHP -


this question has answer here:

i have 2 fields (at minimum) both have same name attribute. using little jquery, user can add more text boxes using jquery's .clone() feature. every possible input add have same name attribute first two. want try use php create comma separated list of every input value after form submitted.

$competitor_names = $_post['competitor-name']; $competitorlist = ''; foreach($competitor_names $competitorlist) {     $competitorlist = $competitorlist.', '; } 

the function implode() seems you're looking :

$competitor_names = $_post['competitor-name']; $competitorlist = implode(',', $competitor_names); 

Comments

Popular posts from this blog

service - Android MediaPlayer calls onCompletion before it already finished -

javascript - Training Neural Network to play flappy bird with genetic algorithm - Why can't it learn? -

javascript - Create a stacked percentage column -