3 Replies Latest reply: Apr 25, 2009 3:17 AM by David_Powers RSS

    PHP newbie: Can DW form data values effect Html on different pages?

    the_missing_link Community Member

      I am working on making form data effect HTML pages but I am not sure how to execute the whole thing. I have a php document and I have filled in a drop down menu with names and values that I would like to be placed into an HTML page.  Oh I also was wondering code snippets on the forum are they copyrighted or can anyone use them?

        • 1. Re: PHP newbie: Can DW form data values effect Html on different pages?
          David_Powers CommunityMVP

          Dreamweaver has a lot of support for PHP, including a suite of server behaviors that speed up development of websites that use a MySQL database. It also has a lot of PHP code hints (more than 2,000), and syntax colouring. So, yes, Dreamweaver can help you work with PHP, but you need a solid understanding of HTML, together with a knowledge of the basics of PHP and SQL before you start.

           

          PHP is a server-side language that processes the content of a web page on the server before sending the output as HTML to the browser. Unless your server is configured to handle .html pages as PHP (most aren't, and it's not recommended anyway), you need to save pages with a .php file name extension in order to use PHP.

           

          Data entered into a form can be used to affect the output on other pages. To give a very simple example, if a form contains a text field called "username", the value entered in that field can be displayed using a PHP variable. If the form is submitted using the POST method, you display the value in the next page like this:

          <p>Welcome, <?php echo $_POST['username']; ?>!</p>
          

          That's a deliberately simple example; and in practice, you would need to filter the form value to make sure it doesn't leave you vulnerable to cross-site scripting.

           

          If you want to start using PHP in Dreamweaver, I recommend that you take time to learn the basics of PHP before using it in web pages. The PHP online documentation is very good, and it includes a simple tutorial. However, you might find that trying to wade your way through the documentation on your own is rather like trying to swallow a dictionary. It's more of a reference than a learning aid. There are a lot of PHP tutorials on the web, but many of them are old, and don't necessarily follow best practice.

           

          If you want to learn about PHP in a Dreamweaver context, you might be interested in my books (details on my website at http://foundationphp.com/).

           

          Finally, your question about copyright. The copyright of code remains with whoever wrote it, but any code published in these forums is free to use, unless marked otherwise (but no one should post code here that they don't want others to use). The same goes for the code in my books. It's there for you to learn from and use freely in your own projects.

          • 2. Re: PHP newbie: Can DW form data values effect Html on different pages?
            the_missing_link Community Member

            I just bought your book and I read a few pages on amazon before purchasing. I can't wait to get it!