At 2:35 PM -0400 5/14/09, PJ wrote:
I'm a bit fuzzy on the relationship between the <? ?> and the HTML code.
Where should the php code be placed in a page so that execution is
carried out smoothly? So far, my coding has managed to avoid horrendous
snags; but as I delve deeper into the quagmire of coding, I would like
to clear the fog before me.
Perhaps I have been fortunate up to this point... :-)
PJ:
First, do not use <? ?> -- that's a short tag and it has been
depreciated and will not work with xml.
Second, use <?php ?> instead.
Third, place the php code anywhere you want within the html document
(top, bottom, middle, and any where). It makes no difference (other
than readability) -- all of it will be executed before the browser
see's anything.
Fourth, if you want php to print something along with (inside) the
html, simply echo() it, such as:
<h1>
<?php echo("Hello World"); ?>
</h1>
and Hello World will be show as a H1 headline.
Please note, the "()" seen in my use of echo is not necessary -- it's
just another one of those things that I do that no one else does.
It's not wrong, but it serves no purpose other than it looks good and
makes sense *to me* YMMV.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php