Reputation: 173
The following is a markup I have for displaying my database:
$html = '';
$database_enquiry = tep_db_query("(relevant database enquiry in here)");
while ($database = tep_db_fetch_array($database_enquiry)){
$html .= '<tr>';
$html .= ' <td>'.$myV['myVariable goes here'].'</td>';
$html .= ' <td><button id="editDriver"></button><button id="timeDriver"></button></td>';
$html .= '</tr>';
}
echo $html;
For some reason, the rows, are displaying in the loop, but the buttons are only showing up for the first row. Anyone know why?
Upvotes: 0
Views: 1464
Reputation: 1950
IDs, as their name imply, should be unique to a document, you are duplicating the buttons IDs for every row.
Normaly most browsers don't make a fuss if you have dulicates (though they should), but it seems in your case, it's causing problems.
So, give your buttons unique IDs accross rows, or use classes to see if it helps:
$html .= ' <td><button class="editDriver"></button><button class="timeDriver"></button></td>';
Upvotes: 2
Reputation: 9910
There are 3 things you need to fix/check:
id
attribute id unique. You should not have more than one per page<tr></tr>
tags should be inside a <table></table>
element.Also, you should check the official documentation for the button element: http://www.w3.org/wiki/HTML/Elements/button
Upvotes: 0