Cragsterboy Posted October 13, 2008 Share Posted October 13, 2008 I was wondering if there was away of selecting a column of a table and then the text in the cells in that column get surrounded by certain text, on a click of a button. is this possible? Thanks ~Crag Quote Link to comment https://forums.phpfreaks.com/topic/128175-selecting-a-column-of-a-table/ Share on other sites More sharing options...
Zane Posted October 13, 2008 Share Posted October 13, 2008 Most likely yes. care to elaborate Quote Link to comment https://forums.phpfreaks.com/topic/128175-selecting-a-column-of-a-table/#findComment-663838 Share on other sites More sharing options...
Cragsterboy Posted October 13, 2008 Author Share Posted October 13, 2008 ok im making a report converter for a game, it converts a report into bbcode to be pasted into the forums, but when i do it atm it all collects on the left side of the forum. SO my converter atm outputs the bb code into a table and i was wanting the right column of the tables cells to have [ center] tags around them so when the bbcode is copied and pasted into the forums it looks more formatted:) Here is the current code to my table: $bbword = explode("\n", trim($bbword)); echo '<table><td>'; // Start a table $size = count($bbword); $valBreak = '</td><td>'; // Set the value that will be put between the values for($i = 0; $i < $size; ++$i) { echo $bbword[$i]; // See if the next value starts with '-' and output it if it is if(isset($bbword[$i+1]) && $bbword[$i+1][0] == '-') { echo ' ' . $bbword[$i+1]; ++$i; // Move the pointer up one since we've outputted 2 values this loop } // Output the between-item value if it isn't the last loop of the array if(isset($bbword[$i+1])) { echo $valBreak; } // Swap the between-item value every other loop $valBreak = ($valBreak == '</td><td>') ? '</td></tr><tr><td>' : '</td><td>'; } echo '</td></tr></table>'; // End the table so how would i be able to do it? Thanks ~Crag Quote Link to comment https://forums.phpfreaks.com/topic/128175-selecting-a-column-of-a-table/#findComment-663843 Share on other sites More sharing options...
Cragsterboy Posted October 13, 2008 Author Share Posted October 13, 2008 im guessing theres no way to do this Quote Link to comment https://forums.phpfreaks.com/topic/128175-selecting-a-column-of-a-table/#findComment-664174 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.