kelsjc Posted October 3, 2010 Share Posted October 3, 2010 Hi all This is probably the easiest question ever , but I am not familiar with arrays , so hope somebody can help me User post this checkbox form (array): <input type="checkbox" name="type[0][]" value="1" > <input type="checkbox" name="type[0][]" value="2" > <input type="checkbox" name="type[0][]" value="3" > I need to get all checked values and print them ... How can I do this? I tried the code below, but it only returns me one value $values = array($_POST["type"]); foreach ($values as $item){ echo $item; } Any help??? Thanks!! Link to comment https://forums.phpfreaks.com/topic/215068-how-to-print-an-array-of-post/ Share on other sites More sharing options...
BlueSkyIS Posted October 3, 2010 Share Posted October 3, 2010 $values = $_POST['type'][0]; Link to comment https://forums.phpfreaks.com/topic/215068-how-to-print-an-array-of-post/#findComment-1118641 Share on other sites More sharing options...
Andy-H Posted October 3, 2010 Share Posted October 3, 2010 $values = implode('<br />', $_POST['type'][0]); echo $values; Link to comment https://forums.phpfreaks.com/topic/215068-how-to-print-an-array-of-post/#findComment-1118668 Share on other sites More sharing options...
rwwd Posted October 3, 2010 Share Posted October 3, 2010 foreach($_POST AS $key=>$value){ echo "This is the key ".$key." And this is it's ".$value."</br>"; } Should be able to finish that off from that. Rw Link to comment https://forums.phpfreaks.com/topic/215068-how-to-print-an-array-of-post/#findComment-1118693 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.