How To Create Rows & Columns using php and html

https://stackoverflow.com/questions/26339763/how-to-create-rows-columns-using-php-and-html/26342013





It is not possible the way you want it to be done. You have to create a 2D array and get the data from that. Here is an example:
<?php
// On the line below, create your own associative array:
$myArray = array (  'Early (Payment received by 1/4/15)' => array('MD/DO', '$23','RNA/PA', '$37','RESIDENT/RN/OTHERS', '$49'),
                    'Early (Payment received by 1/4/15) ' => array('MD/DO', '$23','RNA/PA', '$37','RESIDENT/RN/OTHERS', '$49'));

// On the line below, loop through the array and output
// *all* of the values to the page:
print '<table width="800" cellpadding="1" cellspacing="1" border="1">';
foreach ($myArray as $place => $task) 
{
    print "<tr><td rowspan='4'>".$place."</td></tr>";
    $i = 0;
    print "<tr>";
    foreach ($task as $thingToDo)
    {
        $i++;
        if ($i == 2)
        {
            print "<td>".$thingToDo."</td>";
            print "</tr>";
            $i = 0;
        }
        else
        {
            print "<td>".$thingToDo."</td>";
        }
    }
}
print " </table>";
?>
Output: enter image description here

Comments

Popular posts from this blog

How to add image, header, and footer in PDF | PHP FPDF Tutorial Final

log in with facebook , paypal, php to pdf

How to make awesome stylish comment input box in PHP language for my website.