Start your free trial now, and begin learning software, business and creative skills—anytime, anywhere—with video instruction from recognized industry experts.

Start Your Free Trial Now

Creating and testing a PHP-based web page


Dreamweaver with PHP and MySQL

with David Gassner

Video: Creating and testing a PHP-based web page

Once you've defined your Dreamweaver site and associated it with your PHP server, you can start creating brand new PHP pages. For the remainder of this video series, I'll work with Dreamweaver in a new workspace named App DeveloperPlus. You can get to this work space by opening the workspace selector on the top toolbar of Dreamweaver and choosing App DeveloperPlus. You should see the following layout: CSS Styles and AP Elements at the top, Files, Assets and Snippets at the bottom on the left, and then miniature buttons that allow you to open panels like Insert, Databases, Bindings and Server Behaviors.
Expand all | Collapse all
  1. 8m 48s
    1. Welcome
      1m 25s
    2. What you should know before watching this course
      2m 17s
    3. Using the exercise files
      1m 40s
    4. Understanding the differences between Dreamweaver CS5.5 and CS6
      3m 26s
  2. 19m 31s
    1. Understanding static vs. dynamic web pages
      4m 32s
    2. Selecting application and database servers
      6m 10s
    3. Introducing Apache, MySQL, and PHP
      6m 36s
    4. Installing Apache, MySQL, and PHP
      2m 13s
  3. 39m 34s
    1. Defining a Dreamweaver site
      3m 22s
    2. Configuring a PHP testing server
      7m 48s
    3. Creating and testing a PHP-based web page
      8m 25s
    4. Adding PHP commands with the Insert panel
      3m 14s
    5. Setting and outputting simple variables
      3m 56s
    6. Testing pages with Live view and Live Code view
      2m 9s
    7. Using server-side includes
      7m 50s
    8. Navigating included pages with the Code Navigator
      2m 50s
  4. 36m 37s
    1. Using code hinting with PHP variables
      5m 31s
    2. Understanding PHP custom classes
      6m 38s
    3. Adding Zend Framework to PHP on Windows
      5m 18s
    4. Adding Zend Framework to PHP on Mac
      4m 2s
    5. Using the Site-Specific Code Hints feature
      3m 43s
    6. Using Zend Framework classes with code hints
      7m 26s
    7. Managing reusable code with the Snippets panel
      3m 59s
  5. 18m 27s
    1. Understanding relational databases
      5m 26s
    2. Creating a MySQL database in phpMyAdmin
      4m 41s
    3. Adding data in phpMyAdmin
      2m 46s
    4. Importing a completed database from a script
      5m 34s
  6. 39m 35s
    1. Defining a Dreamweaver database connection
      5m 27s
    2. Building a simple recordset
      4m 31s
    3. Building an advanced recordset
      5m 1s
    4. Displaying data with repeating regions
      6m 4s
    5. Displaying data in a dynamic table
      4m 15s
    6. Formatting dynamic data
      4m 54s
    7. Displaying the total number of records
      2m 4s
    8. Limiting records with paging controls
      4m 5s
    9. Creating conditional regions
      3m 14s
  7. 43m 12s
    1. Building a simple data entry form
      5m 27s
    2. Handling form submissions with PHP
      5m 12s
    3. Creating a customer email form
      3m 9s
    4. Validating form controls with Spry
      7m 54s
    5. Populating a list control with dynamic data
      4m 50s
    6. Working with multiple checkbox controls
      8m 5s
    7. Sending email with Zend_Mail
      8m 35s
  8. 50m 51s
    1. Using data wizards
      6m 20s
    2. Formatting dates for SQL
      5m 27s
    3. Creating a custom data entry form
      4m 50s
    4. Preparing a database table for server behaviors
      3m 3s
    5. Using the Insert Record server behavior
      5m 42s
    6. Preparing an update form
      7m 6s
    7. Using the Update Form behavior
      5m 46s
    8. Creating list page links to edit and update data
      7m 3s
    9. Using the Delete Record server behavior
      5m 34s
  9. 14m 45s
    1. Creating a login form with a PHP server behavior
      6m 29s
    2. Protecting page access with PHP server behaviors
      4m 17s
    3. Logging out with a PHP server behavior
      3m 59s
  10. 22m 50s
    1. Configuring a remote server with FTP credentials
      4m 42s
    2. Synchronizing site assets with the remote server
      5m 27s
    3. Exporting the MySQL database to a script
      3m 8s
    4. Importing the MySQL database on a remote server
      2m 24s
    5. Configuring the site for the remote database
      7m 9s
  11. 52s
    1. Final thoughts

please wait ...
Watch the Online Video Course Dreamweaver with PHP and MySQL
4h 55m Intermediate Sep 22, 2010 Updated Jun 12, 2012

Viewers: in countries Watching now:

Join author David Gassner as he describes how to add dynamic data to a PHP-enabled web site in Adobe Dreamweaver. This intermediate course shows how to plan and create a MySQL database, define a PHP-enabled site in Dreamweaver, connect the site to the database, and manage and present dynamic data. David also explores Dreamweaver features such as PHP custom class introspection and site-specific code hinting as well as the differences between the CS5 and CS6 versions of the software.

This course was updated on 6/12/2012.

Topics include:
  • Understanding dynamic versus static content
  • Adding PHP commands to web pages
  • Setting and outputting variables
  • Using server-side includes
  • Creating PHP custom classes
  • Adding the Zend Framework to a PHP installation
  • Creating a MySQL database
  • Adding data in phpMyAdmin
  • Building recordsets
  • Formatting dynamic data
  • Building data entry forms
  • Authenticating users
  • Deploying a dynamic site
Business Developer Web
David Gassner

Creating and testing a PHP-based web page

Once you've defined your Dreamweaver site and associated it with your PHP server, you can start creating brand new PHP pages. For the remainder of this video series, I'll work with Dreamweaver in a new workspace named App DeveloperPlus. You can get to this work space by opening the workspace selector on the top toolbar of Dreamweaver and choosing App DeveloperPlus. You should see the following layout: CSS Styles and AP Elements at the top, Files, Assets and Snippets at the bottom on the left, and then miniature buttons that allow you to open panels like Insert, Databases, Bindings and Server Behaviors.

For this demonstration, I'll point my site definition to a new folder, I'll go to the Menu and choose Site > Manage Sites and then click Edit with the selected site, then for the local site folder I'll click the icon to browse. If you worked through the previous video, your folder will be pointed to 02_testingserver. I'll go up one folder from there and then down to 03_newphppage. I'll click Select and Save, and then click OK to close the cache notification dialog and click Done.

The Files panel in this workspace appears in the lower left corner. You should see all of the site files and the PHP-based homepage, index.php. Now the goal of this demonstration is to create a brand new PHP page from scratch. From the Menu choose File > New. In the New Document dialog choose Blank Page category and then down at the bottom choose PHP. If you're creating a page for your own site, you might want to use one of the standard layouts provided in Dreamweaver CS5.

These layouts make very good use of cascading style sheets, or CSS, to accomplish their layouts. You can choose any of these and your file will be created as a PHP file. I'm not going to use any particular layout though, because I want to keep this exercise very simple and focused. So I'll set the layout to None and click Create, then I'll go into Code view. As I've mentioned previously, a PHP page is nothing more than an HTML page. When you create a brand new PHP page from scratch in Dreamweaver, you end up with a skeleton of an HTML page.

I'm going to set the title of this page, changing it from Untitled Documents to PHP Info, then I'll save the file, selecting File > Save As, and I'll name it phpinfo.php, because I designated this as a PHP file from the beginning. If I didn't add the file extension at this point, Dreamweaver would add .php for me, I'll click Save. Now I'm going to use a very simple PHP command that outputs information about the configuration and version number of my PHP server.

I'll place the cursor after the starting body tag and press Enter a few times, and place the cursor between the body tags. then I'll go to the Insert panel, I'll click the Insert button, and in the panel I'll pull down the list of available options and choose PHP. The Insert panel will help you insert standard PHP code. I'm going to add a Code Block by clicking once, make sure you only click once, if you double-click, you'll get two copies of the code.

Then I'll click back on the page and the Insert panel will shrink back down into its original place. A PHP Code Block looks like this, its starts with a less than character and a question mark and then the phrase php in lowercase, and it ends with a question mark and a greater than character. Within the PHP code block, you can add your own PHP code. I'm going to add a function called PHP info. I'll type php and then using Dreamweaver CS5 new code hinting capabilities, I'll hold down the Ctrl key and press the Spacebar.

Dreamweaver CS5 brings up a listing of all of its known commands that start with the term PHP. I'll type IN and I'll find three items that I could add that have php and ini; I'll press the down arrow twice to move down the phpinfo. Notice that Dreamweaver CS5 gives you help automatically. This is the PHP project's own online help that's being displayed, and it'll tell you a lot about the different PHP commands that are available and how to use them.

I'll press Enter to choose phpinfo, and then type in a closing parenthesis, I'm going to call the phpinfo function without passing in any values. Now I'll save the file, selecting File > Save, and then I'll look at the page using Live View. Now before you use Live View, make sure that you can see the browser toolbar, if you can't, you can right-click on any of the toolbars and choose this item Browser Navigation. The Browser Navigation toolbar will show you what the URL is that you're browsing to within Dreamweaver, click Live View.

If you see the dialog box asking you to update the copy on the testing server, click Yes and then click Yes again for dependent files. On the right, you should see design view open up and show the resulting output to the browser. Go to the toolbar and click Design, and that will allow the Design view to take up the full available area. The phpinfo function outputs the current version number of your PHP server and all sorts of other configuration information.

One of the most important things you should know, is the location of your php.ini file, that's the PHP configuration file. I'm working on Windows with WAMP server, so my PHP file is located in my Apache 2.2.11/bin directory. If you're working with MAMP on Mac, the location will be different. Now I'll go back to Code view and see the actual output. So in this exercise, you've created your first dynamic PHP page, you've embedded dynamic PHP server-side code in the page, and at runtime, the PHP server executes the phpinfo function and outputs a bunch of very complex information to the browser.

Here's another way of executing the page through the external browser that I'll give you a little bit more information about what's going on. I'll deselect Live View, then go to the Preview button and choose my favorite browser. Once again I'll copy files to the server directory and here's the phpinfo display again. In the browser, I'll view the source. In Firefox, you can do this by selecting View > Page Source. I'll expand the size of the font so we can see it more easily, because I want to show you that that single function phpinfo actually outputs an entire web page, starting at this point with the doc type and going all the way down to almost the bottom of the page, to this ending HTML tag.

This tells me that if you're using the PHP function, you don't need the rest of the HTML structure. So I'll close the browser, go back to phpinfo.php and I'll delete everything except the PHP command. I'll save the change, run the page in the browser again, once again copying files as needed. I'll view the source and this time I only see the output of the phpinfo page.

As I'll show you in the other exercises, most of the time in your actual production pages, you'll be mixing your own custom HTML and cascading style sheets with your PHP commands to output information, but the phpinfo function is a critical tool that can help you find out what's going on, on your PHP server, which version of PHP you're running, and a lot of information about its configuration.

Find answers to the most frequently asked questions about Dreamweaver with PHP and MySQL .

Expand all | Collapse all
please wait ...
Q: The Bindings panel is disabled, and I can't create new queries or form variables in the current PHP file. How can I correct this problem?
A: This indicates that the file you have open isn't a part of your current site. For example, you might have opened a file from one site, then switched sites and tried to continue working on the same file. Try closing all files, then opening the file you want to work on from the Files panel. This ensures that the current file and site are in sync.
Q: I'm having trouble getting code hinting to work on Mac OS X. Are there know issues that could be causing the issues?
A: There might be an issue with your code hinting configuration. Make sure the folders you designated in the code hinting config screen match the disk location where you copied the Zend Framework files. You should have a file named dw_php_codehinting.config in your site root folder after setting up your code hinting configuration. Assuming you copied the Zend Framework files to a folder on your Mac named /phpincludes, the contents of the file might be: "/Volumes/Macintosh HD/phpincludes/ZendFramework/library/Zend/Date" EXTENSIONS(.php) "/Volumes/Macintosh HD/phpincludes/ZendFramework/library/Zend" EXTENSIONS(.php).  The exact path will differ depending on your hard disk name and the folder to which you copied Zend Framework. For subsequent exercises in the video series, the sample files provided with the course have the configuration for Windows as demonstrated in the videos. Once you get code hinting working in one exercise, you can copy the working dw_php_codehinting.config file from the current site folder into the new site folder.
Q: I’m following along in the video "Configuring a PHP testing server." When I go to preview the index.htm or .php files, I don't get the Dependent Files dialog box, and I get the page in my browser with just the HTML and no styling. The index file gets copied to the proper folder, but none of the dependent files are getting copied over. How can I resolve this issue?
A: If you are experiencing this problem, check your settings in Dreamweaver. The prompts for putting files onto the server have most likely been turned off. Follow these steps: 1) On Windows, select Edit > Preferences. 2) In the Preferences dialog, select the Site category. 3) Make sure your options for Dependent Files (prompt on get/check out, and prompt on put/check in) are selected. 4) Make sure your Put and Move options are selected (located at the bottom of the screen). 5) Then try previewing the file again. The dialogs should appear.
Q: I am having a problem with the "Handling form submission with PHP" video in Chapter 6. When I create a form variable "firstname" in the the Binding panel, in the Simpleform2.php file, I don't see the new variable in the list afterwards. It's as if the panel is disabled. What's going on?
A: Some users have reported that this problem can be corrected by deleting a file named  ".mno" from the site folder's _notes subfolder. The file is hidden, so you won't see it in Finder on Mac or Explorer on Windows. Note that there might be many files in the _notes subfolder with the .mno extension, but you only need to delete the file with no name and just the extension.

Follow these steps to delete the file:

Open a command window
Switch to the site folder
Type these commands:

cd _notes
attrib -H .mno (this removes the hidden flag from the file)
del .mno (this deletes the file)

Mac OS X:
Open Terminal
Switch to the site folder
cd _notes
ls -a .mno (if the file is there, this command will show it)
rm .mno (this deletes the file)
Q: I want to use the Zend Framework in my PHP site, but my internet service provider (ISP) doesn't let me modify the php.ini file to include the files as taught in the course. What can I do?
A: If your host doesn't let you make changes to your php.ini file, you can include the Zend Framework with one of these strategies:

  • Copy the Zend Framework to the folder containing your web site files. In your PHP pages, your 'include' command can refer to the appropriate files with relative directory addressing:

 <?php include('../ZendFramework/library/Zend/Date.php'); ?

  •  If your shared host provides a special directory to contain your web files (for example, it might be named 'www' or 'web'), then you can add the Zend Framework files to your root folder as a sibling to the web folder. You'll need to find out the physical folder name; PHP's $_SERVER['DOCUMENT_ROOT'] variable can help you find this:

 <?php echo $_SERVER['DOCUMENT_ROOT']; ?

You can then programmatically modify the include_path variable at runtime with the set_include_path() function. For example, if your physical root folder is /home/myroot, the code might look like this:

set_include_path('.' . PATH_SEPARATOR .
Q: This course was updated on 6/12/2012. What changed?
A: This course was updated to show the minor UI differences between Dreamweaver CS5 and CS6, especially the change from separate Live Code/Live View buttons to a single Live button.
Q: phpMyAdmin is not opening properly in the second lesson in Chapter 4, "Creating a MySQL database in phpMyAdmin." The error message says:

#2002 - The server is not responding (or the local MySQL server's socket is
 not correctly configured)
A: The error indicates that there's an incorrect reference to the MySQL 'sockets' file. This is set automatically during WampServer installation, but if you've previously installed other copies of MySQL there can be some leftover conflicts (even if you've uninstalled the other copies).

Check your system for duplicate copies of the file 'my.ini' - it's a MySQL configuration file that might have been left around from a previous installation. The most likely folder in which to look is c:\windows\System32, but it could also be elsewhere. If you find any such files that aren't in the c:\wamp directory structure, rename or delete them, then reboot your system.

If that isn't the issue, you'll need to start from scratch: back up your working files from c:\wamp\www, then uninstall WampServer, delete the c:\wamp folder completely, and reboot and reinstall. Test phpMyAdmin immediately after installation. Then, if it stops working along the way you'll have better information about what steps might have cause the issue.
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.

Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ .

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

* Estimated file size

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.

Mark all as unwatched Cancel


You have completed Dreamweaver with PHP and MySQL.

Return to your organization's learning portal to continue training, or close this page.


Upgrade to View Courses Offline


With our new Desktop App, Annual Premium Members can download courses for Internet-free viewing.

Upgrade Now

After upgrading, download Desktop App Here.

Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member ?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Learn more, save more. Upgrade today!

Get our Annual Premium Membership at our best savings yet.

Upgrade to our Annual Premium Membership today and get even more value from your subscription:

“In a way, I feel like you are rooting for me. Like you are really invested in my experience, and want me to get as much out of these courses as possible this is the best place to start on your journey to learning new material.”— Nadine H.

Start your FREE 10-day trial

Begin learning software, business, and creative skills—anytime,
anywhere—with video instruction from recognized industry experts. provides
Unlimited access to over 4,000 courses—more than 100,000 video tutorials
Expert-led instruction
On-the-go learning. Watch from your computer, tablet, or mobile device. Switch back and forth as you choose.
Start Your FREE Trial Now

A trusted source for knowledge.


We provide training to more than 4 million people, and our members tell us that helps them stay ahead of software updates, pick up brand-new skills, switch careers, land promotions, and explore new hobbies. What can we help you do?

Thanks for signing up.

We’ll send you a confirmation email shortly.

Sign up and receive emails about and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from

Sign up and receive emails about and our online training library:

Here’s our privacy policy with more details about how we handle your information.

submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.