ive got number of textboxes that will be filled in with name from database.
i create 5 textinputs, using for.. loop
for($i=1; $i<=5; $i++) {
echo '<input type="text" value="">';
}
my question is how do i enter the names to the each textboxes dynamically.
i tried:
$q = $db->query("SELECT * FROM att WHERE id_bs_res='$id_bs_res'");
for($i=1; $i<=5; $i++) {
while($r = $q->fetch_assoc()) {
echo '<input type="text" value="'.$r['att_name'].'">';
}
}
if there are 3 names in database, it will only show 3 instead of 5 textboxes? i want it shows all the textboxes even if the rest of textboxes will be blank.
sample textboxes
1. names
2. names
3. names
4. ------
5. ------