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 Quote 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. Quote 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); Quote 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>'; Quote 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. Quote 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. Quote 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.. Quote 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? Quote 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 Quote 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. Quote Link to comment https://forums.phpfreaks.com/topic/235138-array-returning-array/#findComment-1208522 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.