henricar Posted April 29, 2011 Share Posted April 29, 2011 Hey guys, I am using multiple inputs (checkboxes) to pass values to another page (I have named them name="blabla[]" in order to pass the values an as array). The problem is when I print_r the array, I get "Array" as a result... I have tried imploding it to a string but it doesn't seem to be working. Any ideas on what could be causing this? Thank you Link to comment https://forums.phpfreaks.com/topic/235138-array-returning-array/ Share on other sites More sharing options...
Pikachu2000 Posted April 29, 2011 Share Posted April 29, 2011 Post the code you're using, along with the form field markup in question. Link to comment https://forums.phpfreaks.com/topic/235138-array-returning-array/#findComment-1208450 Share on other sites More sharing options...
henricar Posted April 30, 2011 Author Share Posted April 30, 2011 sure, field markup is: <form action="index.php?p=dosuggtag" method="POST"><input type="hidden" name="sid" value="'. $suggestionid .'"> <b>Suggested Tags:</b> '; while ($i < count($tagarray)) { echo '<input type="checkbox" name="tags[]" value="'. $tagarray[$i] .'">'; echo $tagarray[$i]; echo ' '; $i++; } echo' </td> </tr> <tr> <td width="100%" align="left"> <input type="submit" value="Update Tags"> </td></form> and code to process the array is: $suggtagarray = $_POST['tags']; print_r ($suggtagarray); Link to comment https://forums.phpfreaks.com/topic/235138-array-returning-array/#findComment-1208452 Share on other sites More sharing options...
Pikachu2000 Posted April 30, 2011 Share Posted April 30, 2011 Do the values appear to be correct in the $_POST array if you add this to the script and submit the form? echo '<pre>'; print_r($_POST); echo '</pre>'; Link to comment https://forums.phpfreaks.com/topic/235138-array-returning-array/#findComment-1208454 Share on other sites More sharing options...
henricar Posted April 30, 2011 Author Share Posted April 30, 2011 no.. it still returns Array but the font was different. Link to comment https://forums.phpfreaks.com/topic/235138-array-returning-array/#findComment-1208461 Share on other sites More sharing options...
Pikachu2000 Posted April 30, 2011 Share Posted April 30, 2011 If that's the case, its more than likely that the value you're echoing into the form field's value= attribute is actually an array. Look at the markup in View ---> Source and see what's there. Link to comment https://forums.phpfreaks.com/topic/235138-array-returning-array/#findComment-1208475 Share on other sites More sharing options...
henricar Posted April 30, 2011 Author Share Posted April 30, 2011 just cheked and the value="" value is not a string.. weird.. Link to comment https://forums.phpfreaks.com/topic/235138-array-returning-array/#findComment-1208481 Share on other sites More sharing options...
Pikachu2000 Posted April 30, 2011 Share Posted April 30, 2011 If it isn't a string, what is it? Link to comment https://forums.phpfreaks.com/topic/235138-array-returning-array/#findComment-1208514 Share on other sites More sharing options...
henricar Posted April 30, 2011 Author Share Posted April 30, 2011 sorry about that I meant array! this is what I get when I look at the source: <input type="checkbox" name="tags[]" value="bla">bla <input type="checkbox" name="tags[]" value="csd">csd <input type="checkbox" name="tags[]" value="sfvdk">sfvdk Link to comment https://forums.phpfreaks.com/topic/235138-array-returning-array/#findComment-1208518 Share on other sites More sharing options...
Pikachu2000 Posted April 30, 2011 Share Posted April 30, 2011 Those value= values look like strings to me. Link to comment https://forums.phpfreaks.com/topic/235138-array-returning-array/#findComment-1208522 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.