There are two ways you can use HTML in your PHP page.
The first way is by placing HTML outside the PHP tags.You can put it in the middle if you can open and close PHP tags.
The first way is by placing HTML outside the PHP tags.You can put it in the middle if you can open and close PHP tags.
Here is an example for it:
1 2 3 4 5 6 7 8 | <html> <title>PHP INSIDE HTML</title> <body> <h1>Example</h1> <?php echo "hello world"?> </body> </html> |
As you can see you can use any HTML tags without need any extra work,except saving as .php file.
The second way is by using PRINT and ECHO statements.
Here is an example for it:
1 2 3 4 5 6 7 8 9 | <?php Echo "<html>"; Echo "<title>HTML with PHP</title>"; Echo "<b>My Example</b>"; //your php code here Print "<i>Print works too!</i>"; ?> |
This is simplest and quick method if you only have a line or so to do.Using both these methods you can embed HTML and PHP in same page to gave them a nice formatted look.
If you enjoyed this post, I'd be very grateful if you'd help it spread by emailing or sharing it on Twitter or Facebook. Thank you !! Have a nice day :)
Comments
Post a Comment