Jump to content

Recommended Posts

Then $_POST['book'][$rm] isn't an array. Data not posted yet?

[code]if (isset($_POST['book'][$rm]) && is_array($_POST['book'][$rm])) {
     $checked = in_array($d, $_POST['book'][$rm]) ? 'checked' : '';
}
else $checked = '';

echo "<input type='checkbox' name='book[$rm][]' value='$d' $checked>";[/code]
I tried that and I no longer get the error message about wrong datatype but I still can't seem to get this to work.
I am definitely getting an array as I have done [code]<?php print_r($_POST['book'][$rm]); ?>[/code] and get values from the selected checkboxes.
To test it and see what is going on,I have also echoed $checked but get nothing.
If I put
[code] $checked = in_array($d, $_POST['book'][$rm]) ? 'checked' : 'No';[/code] and echo $checked I get the word "No". So I think the problem is in the value of $d as $d is not in the array even though the array has values.
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.