Hey guys, I have a rather large php scipt and it displays information if a file already exists in the database but it looks out of place compared to the rest of the page. So i was just wondering is there anyway I can change the font and alignment when displaying the information with the echo command?
Thanks for any advice.
Within the echo command you can include html like below:
echo "<p class='mystyle'>".$myvar."</p>";
Alternatively you can be working with html and use:
html code <?php echo $myvar; ?> more html code
Blu
Thanks for the quick replay I can't seem to get this to work, any suggestions?
echo "<p align="center" class="style6">" This is a test. "</p>";
the reason it doesnt work like that cuz u suppose to have the escape quote with backslash
echo "<p align=\"center\" class=\"style6\">This is a test. </p>";
try and see if it works
or replace the the quotes at the beginning and end of the php code with apostraphies
echo '<p align="center" class="style6">This is a test. </p>';
Themanwhowas is correct, however you can also do it the other way round with single quotes around the html as I used in my first posting.
With DOUBLE quotes (NOT single quotes), you can put variables INSIDE the quotes...
echo "<p class='mystyle'>$myvar</p>";
Which is a bit simpler than what wrote Blulagoon...
Blulagoon wrote:Alternatively you can be working with html and use: html code <?php echo $myvar; ?> more html code Blu
Or this one, right
<?= $myvar ?>
Sangre wrote:Or this one, right
Only if short_open_tag is set to TRUE in the PHP config. Since this is dependent on a configuration that is not only deprecated by most but also disabled by some hosts, I wouldn't necessiarly recommend ever using the short_tag styles ('<?=' or '<?').