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

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -