Click to See Complete Forum and Search --> : An activity I can't figure it out.


gokou
04-20-2003, 04:03 PM
I'm reading php, mysql and apache in 24 hours'. They have you do activities at the end of the chapter. So far i've been able to do them, but i'm having trouble on this one.

Create a function that accepts four string variables and returns a string that contains an html table element, enclosing each of the variables in its own cell.

How do you do this?

AdamBrill
04-21-2003, 07:51 AM
Try using something like this:
<?PHP
function addTable($one, $two, $three, $four){
$data = "<table><tr>\n";
$data .= "<td>$one</td>\n";
$data .= "<td>$two</td>\n";
$data .= "<td>$three</td>\n";
$data .= "<td>$four</td>\n";
$data .= "</tr></table>\n";
return $data;
}
echo addTable("one","two","three","four");
?>
That should work for you. :)