canadian_angel Posted June 23, 2010 Share Posted June 23, 2010 i am not sure if I have already posted this and if I have I am sorry, I need to put this in the form of a function, I am trying but its not working. <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/> <title>Teas of the World!</title> </head> <body> <?php // Script 10.6 - Teas of the World.php // This function a four cell table. function makefourcelltable ($table){ echo "<table border='2'> <tr> <th>Chinese Fruit Tea</th> <th>Mexican White Tea</th> <th>Japanese Green Tea</th> <th>British Camomille Tea</th> </tr>"; } echo "<tr>"; echo "<td>" . $table['Chinese Fruit Tea'] . "</td>"; echo "<td>" . $table['Mexican White Tea'] . "</td>"; echo "<td>" . $table['Japanese Green Tea'] . "</td>"; echo "<td>" . $table['British Camomille Tea'] . "</td>"; echo "</tr>"; echo "</table>"; ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/205688-re-i-need-to-put-this-in-the-form-of-a-function-help/ Share on other sites More sharing options...
ohdang888 Posted June 23, 2010 Share Posted June 23, 2010 dude we need way more information this this. try to put what in a function? are you trying to do with this function? whats it doing now? are there any errors? Link to comment https://forums.phpfreaks.com/topic/205688-re-i-need-to-put-this-in-the-form-of-a-function-help/#findComment-1076306 Share on other sites More sharing options...
nuo Posted June 23, 2010 Share Posted June 23, 2010 First off, the string you are echoing : echo "<table border='2'> <tr> <th>Chinese Fruit Tea</th> <th>Mexican White Tea</th> <th>Japanese Green Tea</th> <th>British Camomille Tea</th> </tr>" Should not be encased with " ", they should be encased with ' ', since you are not evaluating the string. Second, why are you creating that function? It doesn't seem to do anything, so why not just use html? If you need dynamic variables in the table, you can just use something like <td><?=$table1 ?></td> Expand on what you're trying to do or give us a better example and we should be able to help you better. Link to comment https://forums.phpfreaks.com/topic/205688-re-i-need-to-put-this-in-the-form-of-a-function-help/#findComment-1076310 Share on other sites More sharing options...
kenrbnsn Posted June 24, 2010 Share Posted June 24, 2010 The string: <?php echo "<table border='2'> <tr> <th>Chinese Fruit Tea</th> <th>Mexican White Tea</th> <th>Japanese Green Tea</th> <th>British Camomille Tea</th> </tr>" ?> is enclosed in double quotes, since there are single quotes in it. If the OP enclosed it in single quotes, the single quotes in the string would need to be replaces with double quotes. Ken Link to comment https://forums.phpfreaks.com/topic/205688-re-i-need-to-put-this-in-the-form-of-a-function-help/#findComment-1076416 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.