Jump to content

PHP array.. checkboxes and an if statement ...easy?


ben_johnson1991

Recommended Posts

Hey guys,

this really should be an easy one, but i can't solve it.

Basically i've got a list of checkboxes, the list is of catalogues from mysql db, with checkbox dedicated to it.

I also have a 'linking' table for the product and catalogues which i used mysql_fetch_array to get the catalogue Id's from that 1 product.

 

then i tried to write if($catalogueID == $catalogueIdFromLinkTable){$checkd = 'CHECKED';}else{$checked='';}

this ran in the while loop for getting the catalogues,

this if statement is supposed to basically check all the catalogues already listed to this product.

 

But obviously this doesnt work because if in the while loop from getting the id's from the link table there is more than 1 id, $catalogueIdFromLinkTable becomes eg"1,3,6" which isn't going to be an id of a catalogue

 

Hopefully this makes a bit of sense and it shouldn't be hard, just one of them brain dead days.

 

Any help'll be awesome!

Cheers,

Ben.

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.