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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.