Header AD

HTML_inside_PHP

You have to check for double quotation marks.Using the ECHO statement may involve the use of double quotation marks because HTML also uses double quotation marks,you can do one of two things to avoid problems:

Escape your HTML double quotation marks with a backslash,as in the following:
echo'<p style=\"font-size:80%;\">";



Use single quotation marks around your html.This can help improve the readability of your code if you have many quotes:

echo'<p style="font-size:80%;">';



Remember that you have still to follow's rules:Follow the PHP guidelines and end your sentences with a semicolon,as well as close all quotes.


Don't try cram too much HTML into your PHP:

EXAMPLE:

<?Php
echo'<table style="font-family:Arial,sans-serif;font-size:80%;';
echo'width:100%">';
echo'<tr>';
echo'<td style="width:50%;">';
echo'First Name:';
echo'</td>';
echo'<td style="width:50%">';
echo $_POST['fname'];
echo'</td>';
echo'</tr>';
echo'</table>';
?>


Php was really needed for was to provided the value represented by $_POST['fname'] and display it on the screen.The rest of the related code was just to output HTML.In this case ,You're better off just staying in HTML and pulling out the PHP line when you need it.
HTML_inside_PHP HTML_inside_PHP Reviewed by Unknown on 4:42 PM Rating: 5

2 comments

angel said...

Great blog nice n useful information , it is very helpful for me , I realy appreciate thanks for sharing. I would like to read more information thanks.

web design company said...

I always get a confusion with the HTML coding making it for the PHP.Simple mistakes make me to think for much time.I think i would have to learn much on this.

Post AD