Tuesday 13 September 2011

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"

";




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

echo'

';




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:

echo'';
echo'';
echo'';
echo'';
echo'';
echo'
';
echo'First Name:';
echo'
';
echo $_POST['fname'];
echo'
';
?>


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.

No comments:

Post a Comment