Copy link to clipboard
Copied
Hi
I am designing a website and using html and php. The problem is I want to add html into my php.
The code looks like this.
<?Php
echo"<font size="2" face="Times"> try later </font>";
?>
I keep getting an error . It seems not to work. How can I manipulate the echoed text in php code?
Hope you can help.
Marking this thread as assumed answered.
Copy link to clipboard
Copied
Hi
The problem is probably that php is confused by all the " (quotes), in the string, you can either escape the quotes of use the heredoc syntax.
See - http://uk2.php.net/manual/en/language.types.string.php.
PZ
Copy link to clipboard
Copied
The page is pretty help but all I want to do is change the font size and design using html when my string is echoed.
I tried using the html syntaxt in the echo but errors are showing up.
Copy link to clipboard
Copied
Hi
Insert your echo statement inside a span and use css to format the results, e.g.
<span class="formatecho"><?PHP echo $r['item_id']?></span>
css -
.formatspan {
color: #000;
font-size: 1.25em;
font-weight: bold;
line-height: 14px;
padding-bottom: 2px;
}
PZ
Copy link to clipboard
Copied
Moved to the Dreamweaver Application Development forum, which deals with PHP and other server-side issues.
Since the line in question doesn't contain any variables, it doesn't even need to be in a PHP echo statement. One of the basic attractions of PHP is that it can be embedded in HTML to display dynamic values. So, only the dynamic values need to be in echo statements.
However, the simple answer to the original question is that you can't nest the same type of quotes inside each other. Use a mixture of single and double quotes like this:
<?php echo '<font size="2" face="Times"> try later </font>'; ?>
Copy link to clipboard
Copied
Hi thank you for the help. It worked for the echo.
I am trying to do the same thing with a or die method in my site.
The code looks like this : or die("<font color='#333333' Size='2'> you a logged in</font>");
When I test the code nothing appears. but without the font modification the information appears.
Could any one help me.
Copy link to clipboard
Copied
On its own, the following code works:
die("<font color='#333333' Size='2'> you a logged in</font>");
Without knowing the context the code is being used in, it's impossible to say why nothing appears.
or die() is used as a condition to end the script if something fails. There must be a condition before the "or".
Copy link to clipboard
Copied
the or die was for a script close on a database query.
I now just changed in to a echo instead.
Thank you for the help.
Copy link to clipboard
Copied
Marking this thread as assumed answered.