Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

echo "" ??

Status
Not open for further replies.

monasa

IS-IT--Management
Jun 27, 2004
41
CA

in a php code I have this line :

echo "<TR> <TD> $nom_prenom </TD> </TR>";

It works but when I add "align "center"", I had an error:

echo "<TR align="center"> <TD> $nom_prenom </TD> </TR>";

Please help

M.N
 
use single quotes around the center
EX:
Code:
echo "<TR align='center'> <TD> $nom_prenom  </TD> </TR>";

When you add the other pair of double quotes it tells the echo command to stop outputting.
 
I disagree with jammer1221's advice.

In HTML, whether you use singlequotes or doublequotes around attributes doesn't matter. Should you have to output XHTML, it does. So I recommend that you use doublequotes around attributes.

Some something like:

Code:
echo '<TR align="center"><TD>' . $nom_prenom . '</TD></TR>';

is probably more appropriate.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
you can also have:

echo "<TR align=\"center\"><TD> $nom_prenom</TD></TR>";

[]'s
 
That will work, too.

And it's okay for a short chunk of HTML. But when you have a script that outputs a complex page, a lot of backslashes reduce readability.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top