mardi 24 mars 2015

How to make a 5 checkbox to be marked with values from databases

i want to make a form with 5 checkbox that will be retrieved from my table genres that contain(ID, name) of books (from database)-this works, and i want to mark old genres from my table book_genre, this contain(ID,ID_book, ID_genre) and then to make an update with new genres - this did not work.


I did this:



<div>
<input type="checkbox" name="ID_gen<? echo $id=$row_genre_new['ID']; ?>"
value="1" <? if($row_genre_old['ID_genre'] ) echo 'checked="checked"'; ?> />
<? echo $row_genre_new['name']; ?>
</div>

<!--
<div>
<input type="checkbox" name="ID_gen<? echo $id=$row_genre_old['ID']; ?>"
value="1" checked="checked" />
<? echo $row_genre_old['name']; ?>
</div>
-->

<? } ?>




Aucun commentaire:

Enregistrer un commentaire