Necuima Posted April 13, 2013 Share Posted April 13, 2013 Hi Larry, I'd like to ask help with a problem that I am experiencing with an HTML table which is generated by PHP echos. When it renders in a browser, four spurious sem-colons appear at the top of the table - in Firefox they are aligned horizontally; in IE9 they are aligned vertically, both on the left hand side of the area immediately above the table itself. Maybe relatedly the table has four columns. It does not need or have a header but I have tried adding blank <th></th> pairs but it makes no difference. The table itself renders perfectly. echo '<table>'; .... other MySQL code here ... echo "<tr> <td rowspan='2'> <div align='center' class='index_table_icon'> <a href='./link to the page that this icon refers to'> <img src='$icon1' alt=''> </a> </div> </td> <td valign='bottom'> <a class='text_link' href='./link to the page that this icon refers to'> $cats[2] </a> </td> <td rowspan='2'> <div align='center' class='index_table_icon'> <a href='./link to the page that this icon refers to'> <img src='$icon2' alt=''> </a> </div> </td> <td valign='bottom'> <a class='text_link' href='./link to the page that this icon refers to'> $cats[4] </a> </td> </tr>; <tr> <td> <p class='index_maintext'> $cats[5] </p> </td> <td> <p class='index_maintext'> $cats[6] </p> </td> </tr> <tr> <td> </td> </tr>"; echo "</table>"; My environment is a Win 7 64 bit PC, Firefox, IE9, Apache, PHP, MySQL. All executions are via localhost. Many thanks in anticipation for any assistance that can be provided. Best regards, Necuima Link to comment Share on other sites More sharing options...
HartleySan Posted April 13, 2013 Share Posted April 13, 2013 Try taking the semicolon out of the following line midway through your code: </tr>; Also, it's not valid HTML to use single quotes for attribute values. You should use only double quotes for HTML attribute values (which is why I generally use single quotes to mark strings that I'm echoing in PHP that contain HTML). Link to comment Share on other sites More sharing options...
Larry Posted April 13, 2013 Share Posted April 13, 2013 It's a common misconception that it's invalid to use single quotes around attributes in HTML. It's actually allowed (single or double). Link to comment Share on other sites More sharing options...
HartleySan Posted April 13, 2013 Share Posted April 13, 2013 So you're right: http://www.w3.org/TR/html-markup/syntax.html#attr-value-single-quoted Learn something new everyday. I think I'll stick with the double quotes though (unless I want to use a double quote in the attribute value). Link to comment Share on other sites More sharing options...
Necuima Posted April 13, 2013 Author Share Posted April 13, 2013 Hi HartleySan, Larry, So obvious!!! You know that I looked at that code till I was blue in the face, to use a local colloquialism, and didn't see that spurious semi-colon!! Many many thanks!! Cheers from Oz:-) Link to comment Share on other sites More sharing options...
HartleySan Posted April 13, 2013 Share Posted April 13, 2013 We use the expression "blue in the face" in America too. I had the exact same conversation with my Australian co-workers the other day, who all thought that that expression was exclusive to Australia. Anyway, glad you solved your problem, and sorry about the misinformation with the single/double quotes. Link to comment Share on other sites More sharing options...
Recommended Posts