shedokan Posted June 20, 2009 Share Posted June 20, 2009 How can I remove the "Column2" from the table? So that: <table> <tr><th>Date <th width='13%'>Column1 <th width='13%'>Column2 <th width='13%'>Column3 </tr> <tr><td>06/20 Fri</td><td >0</td> <td >0</td> <td >0</td> </tr> <tr><td>06/21 Sat</td><td >0</td> <td >0</td> <td >0</td> </tr> </table> will be converted into this: <table> <tr><th>Date <th width='13%'>Column1 <th width='13%'>Column3 </tr> <tr><td>06/20 Fri</td><td >0</td> <td >0</td> </tr> <tr><td>06/21 Sat</td><td >0</td> <td >0</td> </tr> </table> thanks. Link to comment https://forums.phpfreaks.com/topic/163006-remove-second-column-from-a-table/ Share on other sites More sharing options...
RichardRotterdam Posted June 20, 2009 Share Posted June 20, 2009 How can I remove the "Column2" from the table? Given your input I'd say open a text editor and remove the column but that's probably not what you mean. specify your problem a bit more such as: How do you wish to remove the column. When do you want to remove this column Where is this html table etc the more detail the easier someone can help Link to comment https://forums.phpfreaks.com/topic/163006-remove-second-column-from-a-table/#findComment-860082 Share on other sites More sharing options...
shedokan Posted June 20, 2009 Author Share Posted June 20, 2009 What I mean is that I have the html like this: <?php $table="<table> <tr><th>Date <th width='13%'>Column1 <th width='13%'>Column2 <th width='13%'>Column3 </tr> <tr><td>06/20 Fri</td><td >0</td> <td >0</td> <td >0</td> </tr> <tr><td>06/21 Sat</td><td >0</td> <td >0</td> <td >0</td> </tr> </table>"; // here some regular expression or something ?> I just don't have any clue on how to do this. Link to comment https://forums.phpfreaks.com/topic/163006-remove-second-column-from-a-table/#findComment-860116 Share on other sites More sharing options...
RichardRotterdam Posted June 20, 2009 Share Posted June 20, 2009 Ah so you have html stored in a string. As you posted in your comment you could use a regular expression. You can also use DOMDocument Link to comment https://forums.phpfreaks.com/topic/163006-remove-second-column-from-a-table/#findComment-860123 Share on other sites More sharing options...
shedokan Posted June 20, 2009 Author Share Posted June 20, 2009 Your'e right, I can use regular expressions. But I don't know anything about how to make one, so can you help me create one? Link to comment https://forums.phpfreaks.com/topic/163006-remove-second-column-from-a-table/#findComment-860142 Share on other sites More sharing options...
shedokan Posted June 20, 2009 Author Share Posted June 20, 2009 And I mean that an example woulld be great. Link to comment https://forums.phpfreaks.com/topic/163006-remove-second-column-from-a-table/#findComment-860146 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.