From the course: PHP for Web Designers

Unlock the full course today

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

Displaying the values of number and text variables

Displaying the values of number and text variables - PHP Tutorial

From the course: PHP for Web Designers

Start my 1-month free trial

Displaying the values of number and text variables

In a real website the values assigned to variables would be drawn from a database or some other data source, but to keep things simple in this page they have been hard coded here above the Doctype. Now we've got some variables, let's embed them in the HTML to display their contents. And, along the way we'll also look at how to join strings using the dot operator. As well as an important feature of double-quoted strings. So what I want to do is to replace the book title with this variable here, title. So let's just scroll down, and my h2 headings here, Book Title. Select that HTML, delete it, add some php tags. And between them I'm going to type echo, which is the command for displaying simple variable such as text and numbers and it will be echo title followed by a semi-colon. If I save that and go to my browser. I need to load that page. It's 01_05 and the name is display php. And there we are, The Hitchiker's Guide to the Galaxy. The value stored in the title variable is being…

Contents