Forum Moderators: coopster

Message Too Old, No Replies

echo "<table ......what have i done wrong..

         

Flolondon

6:17 am on Jun 7, 2004 (gmt 0)

10+ Year Member



Please any one, what have i done wrong here. Have i used the echo in the right way.

echo "</select>\ n";
echo "<table width="50%" border="2">
<tr>
<td>&nbsp;</td>
<td><p>&nbsp;</p>
<p>&nbsp;</p></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><p>&nbsp;</p>
<p>&nbsp;</p></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><p>&nbsp;</p>
<p>&nbsp;</p></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><p>&nbsp;</p>
<p>&nbsp;</p></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><p>&nbsp;</p>
<p>&nbsp;</p></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><p>&nbsp;</p>
<p>&nbsp;</p></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><p>&nbsp;</p>
<p>&nbsp;</p></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><p>&nbsp;</p>
<p>&nbsp;</p></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><p>&nbsp;</p>
<p>&nbsp;</p></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><p>&nbsp;</p>
<p>&nbsp;</p></td>
<td>&nbsp;</td>
</tr>
</table>


?>

joshie

6:43 am on Jun 7, 2004 (gmt 0)

10+ Year Member



replace

echo "<table width="50%" border="2">
<tr>
<td>&nbsp;</td>
<td><p>&nbsp;</p>
<p>&nbsp;</p></td>
<td>&nbsp;</td>

with

echo "<table width=\"50%\" border=\"2\"> \n";
echo "<tr> \n";
echo "<td>&nbsp;</td> \n";
echo "<td><p>&nbsp;</p> \n";
echo "<p>&nbsp;</p></td> \n";
echo "<td>&nbsp;</td> \n";

You should have an echo statement on each line. This will make it easier to read your code. Remember to terminate your echo with a "; if you start it with a echo "

rizwan

7:22 am on Jun 7, 2004 (gmt 0)

10+ Year Member



yes joshie is true if u use "" around attribute of any tag then u must put a slash before '"' like
<table width=\"500\">

or
u can simply skip the double quots around attributes

another way to use html code to remove th hassle of ""
colse the php tag before html... e.g.

<?php
echo "php code"
//close php tag to start html
?>

<table width="500">
<tr>
<td>Html Row
</td>
</tr>
</table>

<?php
//start php tag again to write php code

echo "php code again";
...
?>

roitracker

10:25 am on Jun 7, 2004 (gmt 0)

10+ Year Member



In addition to the quotes, you have not closed your 2nd echo - should be:

</tr>
</table>
";
?>

barnold4

3:21 am on Jun 13, 2004 (gmt 0)



Or you can use single quotes around your echo statement, and not have to escape double quotes, like:

echo '<table width="50%" border="2">';
echo '<tr>\n';
echo '<td>&nbsp;</td>\n';
echo '<td><p>&nbsp;</p> \n';

And so forth... I am tired now, and that looks weird to me right now, heh... but anyways somethign liek that will work or you can just do

echo '
<table width="50%" border="2">
<tr>
<td>&nbsp;</td>
<td><p>&nbsp;</p>
<p>&nbsp;</p></td>';

either way will yield the same results, different people like to format their php differently...

Remember, though, if you are in single quotes, that it does not parse anything, so if you have a variable you need to do this

echo 'this text wont parse '.$parse.' and then so on';

gosh, it is time for sleep, hope this helped.