New tutorials and articles

I have just added to my site a tutorial on converting a Spry Menu Bar into a server-side include. I have also been busy adding a bunch of brief articles to the Dreamweaver Cookbook on the Adobe site.

I answer a lot of questions in the Dreamweaver forums, and realized that a lot of the solutions I was coming up with for people weren’t easy to find after a couple of days. So, rather than letting them disappear into cyberoblivion, I decided to add any of general interest to the cookbook when I had a few spare moments. The Dreamweaver Cookbook is intended for code samples, and doesn’t have the capability of including screenshots, so I’ll continue posting longer tutorials on my own site. But I hope you’ll find my contributions to the cookbook useful.

Here are direct links to some of the articles I have added to the Dreamweaver Cookbook:

The Dreamweaver Cookbook is open to anyone to either request recipes or contribute recipes of their own. It could turn into a very useful resource if people start using it regularly. Check it out!

This entry was posted in AJAX/JavaScript, Dreamweaver, MySQL, PHP. Bookmark the permalink.

22 Responses to New tutorials and articles

  1. Mollie Twidale says:

    I used your tutorial for changing the default tab for a Spry tabbed panel. Yes, it works, but the tabbed panel no longer works like a tabbed panel – it’s a single long page, and the tabs are not functional anymore. I followed your instructions, from downloading Spry 1.6. Is this the behavior you intended?

  2. David Powers says:

    No, it’s not what I intended. If the tabs are no longer functional, it sounds as though you have made a mistake somewhere. Without seeing the page you have built, it’s impossible to say. Of course, it’s possible there’s a mistake in my tutorial, but you don’t say exactly which tutorial you were using. So you don’t give me much to go on to help you.

  3. Rose says:

    Dear David,

    I’ve been following your tutorial on linking to another page and setting the default Accordion panel. I’m not able to get this to work. First of all, the javascript code for the accordion panel

    var Accordion1 = new Spry.Widget.Accordion(“Accordion1″, {defaultPanel: params.panel ? params.panel: 0, useFixedPanelHeights: false});

    always leave all my panels in the open state. Furthermore, I’m not able to get the panels param to pass through? I’m not sure since all the panel are already open. Here is the link I’m using:

    <a id="content1" href="?recordID=&?panel=1#Accordion1”>

    I would appreciate some input thanks.


  4. David Powers says:

    Rose, It’s impossible to judge without seeing the actual pages, but if all the panels are open, it sounds as though there’s something wrong with the code on the page that contains the accordion. You need to get that sorted first.

    Secondly, your link doesn’t make sense. It has got two question marks and a variable with no value. The href attribute should look something like this: "somepage.html?panel=1#Accordion1".

  5. rose says:

    Dear David,
    Here is the code for the second panel that I’m experimenting with.

    Doctor Who

    <a id="content1" href="?recordID=&?panel=1#Accordion1″>

    And here is the javascript code for the panel animation

    I hope the above information is more helpful.

    What I am doing is passing a php query via an URL to the detail section on the same page. This does work. I’m just trying to get the accordion panel that the user us currently in to stay open. My understanding is any php request cause a page refresh and that is why the panel always defaults to panel=0.

    Thanks a bunch

  6. Rose says:


    I finally got it all to work!
    Apparently I didn’t have the code right in the header for the JavaUtils. Once I got that fixed then my panels opened and closed just fine.

    Next, I added the tab=n in front of the panel=n#Accordion1 in the URL.

    Just to let you know, your tutorial is a bit confusing at that point. I thought you were talking about tabbed panels AND accordion panels. Once I put that in, everything works great.

  7. Kat Williams says:


    I followed your instruction for customizing the horizontal menu bar. Fantastic! Clear and easy to follow. Thank you.


  8. Wow, it’s a lot easier than I thought it would be. Thanks

  9. Kathy says:

    I am designing a web page and I need a condolences form, much like a blog, where the condolences are published on the website. Any suggestions on putting this form on a dreamweaver page.

  10. David Powers says:

    You could use the Building Your First Dynamic Website tutorial in the Adobe Developer Connection as a starting point. However, the big problem with online forms that display user input is spam. That tutorial doesn’t teach how to prevent spam. You could use a CAPTCHA, or get the form to send you an email before you approve comments. That’s why blogs are so useful, because they handle all that side of things for you.

  11. Leolux says:

    The “Upload image to website” recipe in Adobe’s cookbook is great. It works like a charm compared to other tutorials with the same topic.
    If, by chance, you’ll find time to write a recipe about how to insert the image’s name and path into a database you’ll make some users happy.


  12. David Powers says:

    Glad you found it useful. I’m up to my eyeballs writing a new book, so I won’t have time to add anything else to the Dreamweaver Cookbook for some time. Sorry.

  13. Chris R says:


    Sorry to take time from your new book. I suspect it must be the one I pre-ordered at Amazon on Dreamweaver CS5. I never look forward to the end of summer, but this year I am looking forward to August 20th.

    I’m building a page based on the “Upload image to website” recipe. Everything works great unless I try to add a duplicate image. Instead of getting the expected “A file of the same name already exists”, the page throws the error: “Undefined variable: success in C:\vhost\filepath\upload.php on line 29”.

    Line 29 is the first line of the following section:

    if ($success) {
    $result = "$file uploaded successfully.";
    } else {
    $result = "Error uploading $file. Please try again.";

    Success is first mentioned on line 23 and the entire section is:

    $success =
    move_uploaded_file($_FILES['image']['tmp_name'], UPLOAD_DIR .
    } else {
    $result = 'A file of the same name already exists.';
    if ($success) {
    $result = "$file uploaded successfully.";
    } else {
    $result = "Error uploading $file. Please try again.";

    So far I’ve just copy and pasted the code onto a standard blank Dreamweaver PHP page and made the changes needed for my upload directory and filesize. I haven’t added any other HTML or CSS yet. Is there something else I need to change or is there a bug in the code?


  14. stephanie says:

    Hello Mr. Powers,

    is there any place/book where you have the above information on searching a database with optional html input without using dreamweaver? Only php, mysql, and html? Thanks


  15. David Powers says:

    Stephanie, The Dreamweaver-specific part of that script is the use of GetSQLValueString(), which checks that data type (“int”, “text”, etc) and passes the data to mysql_real_escape_string(). Sorry, but I don’t have time at the moment to refactor the script. If you have a reasonable understanding of PHP, it shouldn’t be too difficult to adapt.

  16. Russ says:

    On page 212 of PHP Solutions, 2/e, section 3, you state that getdownloads.php can be found in the Chapter 7 code. I don’t see it there. Would you mind adding it to the downloads at Friends of ED so I can get a copy?

  17. David Powers says:

    The file is called download.php, and it was added to the ch07 folder after another reader alerted me to the problem. Download the zip file again from friends of ED. It sounds as though you downloaded it before the file was added. There’s an error in the code on page 211. See

  18. Frank says:

    Hi Mr. Powers,
    I am going through php solutions 2nd Edition and its a great book. I look forward to creating great websites based on what you teach. My question however is about php frameworks. Many people advocate use of one framework or another. What is your view on frameworks especially for beginners, would it be better to take time to learn the php language then migrate to frameworks later on or can I use a framework while learning php? Any insights would be highly appreciated.


  19. David Powers says:

    Hi Frank, Glad you like the book. My advice is to learn the basics of PHP before embarking on using a framework. Although a framework can save a lot of time and effort, you’ll understand how to use it better if you have a solid understanding of how PHP works. Also, if you decide you don’t like the framework, you have to start learning all over again, because each framework is different.

    Another point to bear in mind is that most frameworks are quite large. The Zend Framework, for example, is 25MB. If you’re planning a complex site, a framework can be very helpful; but it’s often overkill for a small site. My framework of choice is Zend Framework. It’s very well written, has a lot of features, and is backed by Zend, the company run by core contributors to PHP. I cover some of the main features of ZF in my book, Adobe Dreamweaver CS5 with PHP: Training from the Source.

  20. says:

    Hi David,

    I have followed a lot of your tutorials and they are extremely good. At the moment I am trying to create a form that will upload data to MYSQL as well as an image that is stored in a folder on the site and trying to link the image into the MYSQL database all in one step. I am creating this form in the CMS of a website that will be used by people that have no experience at webdesign or management. I need to make it so that they can enter a title, details of an event and upload a picture that is linked to this data all in one form. I can create a form to enter the data no problem, I can create a form to upload the picture no problem, but I can not link the picture to the relative data. I can upload the image into the database, but it becomes somewhat bloated.
    Any help you may be able to provide would be much appreciated as I have been trying for about a week and am pulling my hair out.
    I hope this is the appropriate place to ask you this question.
    Kind Regards
    Brent Taylor

  21. David Powers says:

    If you can create a script to upload files and you can create a script to enter details in a database, you already have sufficient knowledge to do what you want. The form contains text input fields for the title and event details, and a file field for the picture. When the form is submitted, the title and event details are in the $_POST array, the image is in the $_FILES array. The processing script should handle the $_FILES array first. If the image is successfully uploaded, get the name of the image (assuming the file field is called “image”, it’s $_FILES[‘image’][‘name’]), and insert it in the database with the other information from the $_POST array.

    I cover file uploads in detail in PHP Solutions, 2nd Edition, although I don’t cover this particular scenario. However, it is covered in Dreamweaver CS5 with PHP: Training from the Source, using the Zend Framework.

  22. Hisam says:

    Hi David,
    Thanks for the tutorial.
    How to create multi level nested list from php mysql using dreamweaver?