2

I have the following code below for an EthernetClient named client. It is supposed to print a 2 row, 9 column table. The headers are ID and Name and are the first cell in each row. The other columns are the associated data. The problem I am having is that it is only printing the first ID and then the rest of the cells for that row are blank. The names all get printed in the row below it without a problem. Why won't it print the other IDs?

Here is the ID array: String ids[16] = {"00000", "00001", "00010", "00011", "00100", "00101", "00110", "00111", "01000", "01001", "01010", "01011", "01100", "01101", "01110", "01111"};

client.println("<table cellpadding=5, border=1>");
client.println("<tr>");
client.println("<th>ID</th>");
for(int i = 0; i < 8; i++) {
  client.print("<td>");
  client.print(ids[i]);
  client.println("</td>");
}
client.println("</tr>");
client.println("<tr>");
client.println("<th>Name</th>");
for(int i = 0; i < 8; i++) {
   client.print("<td>");
   client.print(name[i]);
   client.println("</td>");
}
client.println("</tr>");
client.println("</table>");
2
  • 2
    Could you show the output your get? Preferably the raw "view-source" html output.
    – Gerben
    Oct 4, 2016 at 19:38
  • I tried your code, changing client to Serial and the output looked OK. It even rendered OK in my web browser.
    – Nick Gammon
    Oct 4, 2016 at 21:03

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.