I have inserted some check box values in mysql database using PHP
And in the below image i have fetch the values:

Now i need the o/p like the below image: The values which i inserted in the database should be checked

Hope now its clear.
Thanks in advance..
You should have a table of available options (in this case, something like a
citiestable), and then a user-to-cities look-up table. Then you can loop over the cities, but also fetch which cities the user has checked.A sample, without knowing your database structure, would be as follows: