Jump to content

Passing checkbox values through hidden inputs?


Unknown98

Recommended Posts

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.