On Feb 4, 2010, at 10:45 AM, web400-request@xxxxxxxxxxxx wrote:
ALSO.... Putting the code in my <PHP section works.......
That's the only way it will (or can) ever work.
PHP variables are nothing but a character string when simply embedded
in HTML. They are only treated as a variable within the context of the
<?php ... ?> bracketing. That is the only part of the script that the
PHP interpreter gets to process - Apache handles the rest.
The normal techniques are either:
1) Use echo to output the entire HTML string e.g. <?php echo
"<htmltag> $phpvar </htmltag>" ?>
2) Embed a php code island within the HTML e.g. <htmltag> <?php echo
$phpvar ?> </htmltag>
The second option has the advantage that most HTML editors will
recognize the php tags and you can see the page the way it is supposed
to be - and of course the html can be validated correctly which it
cannot within an echo.
I've covered some of this stuff in my PHP intro series for RPGers
which is being published by Penton. You can find part 1 here:
http://systeminetwork.com/article/php-rpg-perspective-part-1-phpundamentals%E2%80%94-basics
The link to part 2 is at the the end. Part 3 should be available any-
day-now.
Jon Paris
www.Partner400.com
www.SystemiDeveloper.com
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.