CORT0619 Posted December 10, 2011 Share Posted December 10, 2011 if a user were to select multiple items in a selection list I would like to concatenate those items into a list and assign that into a variable. I know I should loop through the list but i'm not sure how I would continue to add those values to a variable. Quote Link to comment https://forums.phpfreaks.com/topic/252868-multiple-selection-list/ Share on other sites More sharing options...
Pikachu2000 Posted December 10, 2011 Share Posted December 10, 2011 Multiple selections are passed as an array anyhow. Why do you need to concatenate them to a list? Quote Link to comment https://forums.phpfreaks.com/topic/252868-multiple-selection-list/#findComment-1296480 Share on other sites More sharing options...
CORT0619 Posted December 10, 2011 Author Share Posted December 10, 2011 Pretty much I would just like to have each item selected printed out to be sent in an email. Quote Link to comment https://forums.phpfreaks.com/topic/252868-multiple-selection-list/#findComment-1296481 Share on other sites More sharing options...
Pikachu2000 Posted December 10, 2011 Share Posted December 10, 2011 There's no need to go through all the extra code of reassigning the to variables just for that. You can implode the array directly into a string. echo implode( PHP_EOL, $_POST['your_field'] ); Quote Link to comment https://forums.phpfreaks.com/topic/252868-multiple-selection-list/#findComment-1296482 Share on other sites More sharing options...
CORT0619 Posted December 10, 2011 Author Share Posted December 10, 2011 ok thanks. Quote Link to comment https://forums.phpfreaks.com/topic/252868-multiple-selection-list/#findComment-1296524 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.