Unknown98 Posted April 3, 2012 Share Posted April 3, 2012 So, I have a checkbox, like so: (uci is an ID number) <input type='checkbox' name='cars[]' value='".$row['uci']."' /> That is passed to the next page via the form. However I need to pass the id numbers again, through to a third and final page. Currently I'm trying to do it through hidden inputs, but all I get returned to me is the word, "Array". This is the second page, displaying the data it recieves from the checkbox on the first page and attempting to send it through to the third page via a hidden input. $ids = $_POST['cars']; ... Displays data here... ... <form action='step_3.php' method='POST'> <input type='hidden' name='cars' value='$ids' /> <input type='submit' name='submit' value='Final Step' /> </form> I also tried <input type='hidden' name='cars' value='".$_POST['cars']."' /> but that didn't work either. This is what I'm using to display the data on the final page, as a check to make sure it's working (this is where I'm just getting the word, "Array"): echo"Car Id's: ".$_POST['cars']."<br />"; So, I guess my question is how do I pass the multiple options checked on the first page through more than one page? It works fine displaying the data on the second page, however when I try to display it again on the third page via the hidden input, it doesn't work. Quote Link to comment https://forums.phpfreaks.com/topic/260229-passing-checkbox-values-through-hidden-inputs/ Share on other sites More sharing options...
dragon_sa Posted April 3, 2012 Share Posted April 3, 2012 try this on the final page for testing print_r($_POST['cars']); this will show you the array of id's if you still have them Then you need to process the array to suit your needs I assume entering into a database Quote Link to comment https://forums.phpfreaks.com/topic/260229-passing-checkbox-values-through-hidden-inputs/#findComment-1333805 Share on other sites More sharing options...
Jessica Posted April 3, 2012 Share Posted April 3, 2012 On each page you'd need to loop through the array to create the hidden inputs. Try using a session instead. Quote Link to comment https://forums.phpfreaks.com/topic/260229-passing-checkbox-values-through-hidden-inputs/#findComment-1334070 Share on other sites More sharing options...
Unknown98 Posted April 5, 2012 Author Share Posted April 5, 2012 print_r($_POST['cars']); still just returns the word "Array"... so I assume the data isn't being passed all the way through. Sessions... interesting, I hadn't thought of using those. I'll try that, thanks! Quote Link to comment https://forums.phpfreaks.com/topic/260229-passing-checkbox-values-through-hidden-inputs/#findComment-1334520 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.