The PHP scripting language enables you to add interactivity to your HTML. PHP enables you to combine PHP coding with HTML coding like P, SPAN and DIV. Your document can contain more PHP coding with a few HTML codes, or more HTML with a line of PHP. Save your file with a ".PHP" extension so that the server will execute the PHP code.
Things You'll Need
- FTP client
- PHP-enabled server
Launch an HTML or text editor and create a new file. Save your file as "creatediv.php".
Type the start code "<?php" in the file, and then the end code "?>". Insert your PHP code between these tags. Use the "echo" function to output the "DIV" as follows.
echo "<div><p>a paragraph of text within a div</p></div>";
Save the file. Transfer the PHP file to your server with your FTP client. Access the page in your Internet browser and test the functionality.
- Photo Credit Thinkstock Images/Comstock/Getty Images
How to Hide a DIV in JSP HTML
HTML elements can be controlled by server-sided languages using conditional statements. A JSP script using an "if / else" statement can set...
How to Make a DIV Layout
The division (DIV) tag provides Hyper-Text Markup Language (HTML) developers with containers that set the layout for a website template. Using DIV...