From the course: PHP for Web Designers

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

How to use PHP in a web page

How to use PHP in a web page - PHP Tutorial

From the course: PHP for Web Designers

Start my 1-month free trial

How to use PHP in a web page

The web server needs to process any PHP code before it sends the page to the browser. But it won't do that unless you tell it to do so. You do that by giving your web pages the file name extension .php, instead of .htm or .html. Let's create a simple page. I'm in Dreamweaver, and in the welcome screen, there's actually an option for create a page, PHP page. If I click that, you'll see that I get an ordinary web page, complete with doctype and an HTML skeleton. Now what I'm going to do is, I'm going to Save this page. In my exercises folder as embed. And then .php. That PHP filename extension is simply an instruction to the server. It doesn't make any difference the way you build the HTML structure. All the CSS in your web pages. So let's add some HTML and some PHP to this page. First we need to give it a title, so change that Untitled Document to Embedding PHP in HTML. And in the body of the page. Let's have top-level heading, an h1, and we'll just say, This is Plain HTML. And, a…

Contents