Gaia Posted May 3, 2006 Share Posted May 3, 2006 Hi,I have a form that is submitting multiple checkboxes, which when submitted turns into an array.So my $_POST['option'] turns into a foreach.[code]<?php$options = $_POST['option'];foreach ( $options AS $foo ) { $new_options .= 'Something: '.$foo.' ';}?>[/code]The probem is when i submit it to a database the word Array gets stuck to the first option. so say the $options resulted in 3 check boxes being marked, option1, option2, and option3.The output would be...ArraySometing: option1 Something: option2 Something: option3How do i fix that?Thanks. Quote Link to comment Share on other sites More sharing options...
judeddokoinu Posted May 3, 2006 Share Posted May 3, 2006 $options is an array?Do something like:[code]<?php// do a loop on this, most likely...$options[0] = $_POST['option1'];$options[1] = $_POST['option2'];// get the values and store as a string.foreach ( $options AS $key=>$value ){ $new_options .= 'Something: '.$value.' ';}?>[/code] Quote Link to comment Share on other sites More sharing options...
KrisNz Posted May 4, 2006 Share Posted May 4, 2006 [code]foreach($options as $array){ foreach($array as $value) { echo $value; }} [/code] Quote Link to comment 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.