mardi 24 mai 2016

HTML Checkbox and Mysql in PHP script

I have stored multiple user`s information in a table in mysql. These are supposed to be categorized under 5 tags, A, B, C, D and E. The information is stored in the table as follows:

  1. maybe all the above mentioned tags are used
  2. maybe 'A' is used multiple times, same as B, C, etc.
  3. maybe only a few tags are used and other are never used to categorize

I am providing checkbox options for these tags in my html generated by a php script, and when the user checks some or all of the options, it should retrieve the checked tags information from the table and do something.

But in my case, when some tags are checked and those are not stored in the table, I am getting an error (since their is no tag information in the table, obviously). In that case, how should I program, so that even though I checked some tags, and their information is not in the mysql table, the program should ignore them and display the information related to other checked tags. I am not able to write the program in PHP with MySQL queries. It can be a checkbox or a select.

Let me know if the question is unclear, since it is a bit complex to explain here in words.




Aucun commentaire:

Enregistrer un commentaire