mardi 8 mai 2018

Target checkboxes with input values saved in the database

I have the following multiple input checkboxes:

<div id="User_countriesOfCitizenship_multiValue">
      <label for="User_countriesOfCitizenship_1">
            <input type="checkbox" id="User_countriesOfCitizenship_1" name="User_countriesOfCitizenship" value="450"> AALAND ISLANDS
      </label>
      <br>
      <label for="User_countriesOfCitizenship_2">
            <input type="checkbox" id="User_countriesOfCitizenship_2" name="User_countriesOfCitizenship" value="204"> AFGHANISTAN
      </label>
      <br>
      <label for="User_countriesOfCitizenship_3">
            <input type="checkbox" id="User_countriesOfCitizenship_3" name="User_countriesOfCitizenship" value="343587">  AKROTIRI SOVEREIGN BASE AREA
      </label>
      <br>
      <label for="User_countriesOfCitizenship_4">
            <input type="checkbox" id="User_countriesOfCitizenship_4" name="User_countriesOfCitizenship" value="205"> MADAGASCAR
      </label>
      <br>
      <label for="User_countriesOfCitizenship_5">
            <input type="checkbox" id="User_countriesOfCitizenship_5" name="User_countriesOfCitizenship" value="343592"> MALDIVES
      </label>
      <br>
      <label for="User_countriesOfCitizenship_6">
            <input type="checkbox" id="User_countriesOfCitizenship_6" name="User_countriesOfCitizenship" value="444"> NEPAL
      </label>
</div>

and the following variable called "tcCountriesOfCitizenship" that holds number of values stores in the database for countries of citizenships

444, 343587, 343592

Using this, I want to check (mark) the input box if the input value is equal to the values saved in the database.

Please help.




Aucun commentaire:

Enregistrer un commentaire