Setting new document preferences

Click the Preferences button at the bottom left of the New Document dialog box. Alternatively, choose Preferences from the Edit menu Dreamweaver menu on a Mac , and select the New Document category. Either presents you with the New Document Preferences dialog box shown in Figure 1-3. The dialog box lets you set the following global preferences Default document lets you choose the type of document that will be created when you use the keyboard shortcut for a new document Ctrl N Cmd N . For this...

Using variables in a SQL query

Changed To out whether an author has already been registered, you need to check the authors table to see if any record matches the values submitted in the first_name and family_name fields. In other words, you need to search the database or in this case, a single table . If there's a match, you need to stop the Insert Record server from executing. Otherwise, the insert operation can go ahead. Since you don't know what will be entered in the form fields, you need to pass their values as...

Giving elements a unique identity

An id attribute is like an ID in real life to provide a positive method of identification, an id attribute must be unique in the same way as a Social Security number. Once you have assigned an id, you must not reuse it within the same page. You can reuse it elsewhere in the same site, but only once in each page. Many web designers blithely ignore this rule, because CSS usually works perfectly well even if the same id is used several times on a page. Moreover, in spite of its commitment to...

Validating a checkbox group with Spry

Validating a checkbox group is easy, but the default use of lt span gt tags makes it difficult to create a layout that uses valid code and looks halfway decent. However, this is also a good opportunity to show you that you don't need to be constrained by Dreamweaver's way of doing things. The best way to explain is with a practical example based on the form you have been using throughout the chapter. The form has a group of five checkboxes displayed in two columns, each of which is formed by a...

Using phpMyAdmin to generate XML

The XML capabilities of phpMyAdmin are very basic, but they're worth knowing about if you need a quick and easy way to generate a static XML document. You can export data from a single table or from several tables. The structure always looks like this lt DatabaseName gt lt TableName gt lt TableName gt lt DatabaseName gt The name of the table becomes the repeating element that contains each record, and the column names make it easy to identify the data you want to use. The XML that phpMyAdmin...

Creating user accounts for MySQL

At the moment, your installation of MySQL has only one registered user the superuser account called root, which has complete control over everything. A lot of beginners think that once they have set up a password for the root user, they can start building databases. This is a big mistake. The root user should never be used for anything other than administration. MySQL stores all databases in a common directory. So, on shared hosting, your database with all its precious information rubs...

Validating a single checkbox with Spry

A common requirement on forms is a checkbox to confirm that the user agrees with certain terms and conditions. Creating this with Dreamweaver couldn't be simpler. If you already have the checkbox in your form, select it, and click the Spry Validate Checkbox button on the Insert bar. Save the page to copy the external JavaScript file and style sheet to your Spry assets folder. If you don't have a checkbox, position your cursor where you want it to go inside the form, and click the Spry Validate...

Installing MySQL on Windows

MySQL comes in a range of versions, but the one you should choose is Windows Essentials. It contains all the important stuff and certainly everything you need for this book. If you have a version older than MySQL 4.1.5 already installed on your computer, you must unin-stall the old version first. Deciding whether to enable InnoDB support MySQL is capable of storing database tables in a variety of formats. Most of the time, you don't need to worry about this. The default MySQL format, MyISAM, is...

Applying a dynamic value to a radio group

The Administrator radio buttons still don't respond to the changes. We'll fix that next. Continue working with register_user.php from the previous section. 1. When any errors are detected, you need checked checked to be inserted in the tag of the radio button that the user selected. Since the radio group is called admin_priv, the value you want is contained in _POST 'admin_priv' . Although you can type this directly into the Dynamic Radio Group dialog box, Dreamweaver lets you define _POST,...

Choosing single or double quotation marks

As I mentioned earlier, strings must always be enclosed in single or double quotes. If all you're concerned about is what ends up on the screen, most of the time it doesn't matter which quotes you use, but behind the scenes, PHP uses single and double quotes in very different ways. Anything between single quotation marks is treated as plain text. Anything between double quotation marks is processed. Quotation marks need to be in matching pairs. If a string begins with a single quote, PHP looks...

Removing the CSS comments

The comments in the Dreamweaver CSS layouts are deliberately verbose they're there to help you understand what each rule is for. Although commenting style sheets is a good idea, you'll probably want to get rid of the Dreamweaver comments once you're familiar with the layouts. It's very easy to do with Edit gt Find and Replace and a regular expression. Regular expressions describe patterns of text and other characters. They are like wildcard characters but much more powerful. The regular...

Applying the Log Out User server behavior

The Log Out User server behavior will automatically insert a logout link in your page, so you need to position your cursor at the point you want the link to be created. 1. Press Enter Return to create a new paragraph in success.php. 2. Click the plus button in the Server Behaviors panel, and select User Authentication gt Log Out User. 3. The Log Out User dialog box gives you the option to log out when a link is clicked or when the page loads. In this case, you want the default option, which is...

Inserting and configuring a dropdown menu

Continue working with the form from the preceding exercise or copy feedback_checkbox. php from examples ch09 to workfiles ch09. The finished code is in feedback_select.php. 1. Save feedback_checkbox.php as feedback_select.php. 2. To insert the drop-down menu after the checkboxes, insert your cursor anywhere in the second checkbox lt div gt in Design view, click lt div.chkRad gt in the Tag selector at the bottom of the Document window, and press your right keyboard arrow once to move the...

Defining a table in phpMyAdmin

Defining a database table normally requires writing a lengthy SQL query, but phpMyAdmin makes the process a lot simpler through a form-based interface. The form is quite wide and, unless you have a large monitor, you might need to scroll horizontally to see all the fields. You might find the text in some screenshots hard to read, but all important information is repeated in the instructions and Table 14-1. 1. Launch phpMyAdmin, and select the egdwcs3 database. In the main frame, type feedback...

Styling a page

The layout I have chosen for this chapter is 2 column fixed, left sidebar, header and footer. It creates a 780-pixel wide page centered horizontally in the browser. This is designed to fit in an 800X600 monitor. You can change the width to suit your own needs, but I'm going to leave it as it is. The following exercise shows how to start transforming the basic layout. Of course, I didn't just pluck the settings out of thin air it took some experimentation. But the way I did it was exactly the...

Using code hints and auto completion

By default, Dreamweaver displays context-sensitive code hints in Code view. For example, if you type an opening angle bracket after the lt body gt tag of an XHTML page, a context menu pops up displaying all valid XHTML tags, as shown in the screenshot alongside. You can either scroll down to find the tag you want and double-click to insert it or continue typing. As soon as you type di, the context menu highlights lt gt div. Press Enter Return, and Dreamweaver completes the tag name. When you...

Creating a Spry data set from a static XML document

This exercise examines the various options in the Spry XML Data Set dialog box see Figure 19-2 . 1. Create a new web page, and save it as spry_data.php in workfiles chl9. 2. To create a Spry data set, click the Spry XML Data Set button on the Spry tab of the Insert bar, as shown in the following screenshot. iPVlnsert Common Layout Forms PHP Data Spry Text You can also use Insert gt Spry gt Spry XML Data Set, or click the plus button in the Bindings panel and select Spry XML Data Set from the...

Understanding how dynamic pages work

Back in the early 1990s, web pages consisted of nothing but text. Things didn't stand still for long, and it soon became possible to add images and scrolling text. But even if some things moved around the page in an irritating way, everything on the Web was static in the sense that the content was fixed at the time the page was created. Genuinely dynamic features began to be added around 1995 with the help of two distinct types of technology client-side and server-side. The primary distinction...

Insert bar

Changed lnsert bar is really a collection of toolbars used to perform the most frequently used operations in building web pages. It's organized as a tabbed interface. Figure 1-6 shows the Common tab. When you first launch Dreamweaver, there are six other tabs or categories . Additional, context-sensitive tabs are displayed only when the features can be used in a particular page, such as when using PHP or the XSL Transformation server behavior. The tabs organize program features in logical...

Exploring the workspace

Dreamweaver Cs3 Workspace

Figure 1-4 shows the default Windows workspace with a web page under construction and all the main areas labeled. The main part of the workspace is occupied by the Document window, which includes everything from the Document toolbar to the Tag selector. Figure 1-4. The Dreamweaver workspace remains basically unchanged. Figure 1-4. The Dreamweaver workspace remains basically unchanged. As you can see from Figure 1-5, the Mac workspace is virtually the same. In harmony with other Mac programs,...