I have a index frameset htm file is it possible to change the index.htm file
to index.php without getting problems? All the other pages is named
htm.
The reason i want to do this is that i want to run some php scripts that
only work with the php exstension.

I also have a question about using html in php files, i know using php
in html sites works does it work the same way the other way around?

    Using a .php file in a frame will work fine.

    Your second question, frankly, doesn't make sense. There is no such thing as a "PHP site" or an "HTML site". They are two different technologies, designed to perform two different tasks, which complement each other.

    HTML, as you know, is a markup language, designed to describe the structure of textual data.

    PHP is a programming language - that is, it executes logical instructions - which is used to generate HTML on the fly, usually by reading from or writing to a database, processing that data as necessary, and producing appropriate an appropriate result - in the form of HTML code - to display to the user.

    If your web server supports PHP, you can use PHP files on your site.

      Hmm to make things a bit more clear:

      If you use PHP codes in an html, they will just be displayed as plain text. If you want to use HTML in php files you have do like this:

      <?
      //Some PHP code first
      if ($sam = "sam")
      { echo "call sam"; }
      ?>
      <!-- PHP in now turned off in this file, so now you are free to use HTML codes, another way is to do like this: -->
      <?
      //a simple phrase with both php and html::
      echo "<b>$sam</b>";
      ?>
      

      Hope that answers your question.

        Ah, now I see what you mean.

        By default, Apache will only run .php files through the PHP interpreter, and .html files will simply be output directly to the client, without any attempt to look for PHP code in the file.

        However, you can configure Apache to run HTML files through the PHP interpreter as well, if you have access to edit the Apache config files.

        Just think of PHP files as HTML files with islands of PHP code floating in them. Anything inside <?php ?> brackets will be executed as PHP code; anything not inside <?php ?> brackets will simply be written directly to the client.

          OK thanks for your answers Greenie and Errors. I can explain what im trying to do i have madea htm site that
          i want to put a php counter uniuqe visitors script on the first page but for that to work the index file has to be renamed php. Will all links to the other htm pages still work the same way as if the index was named htm and will the index site still look and work the same?
          Im just starting to learn php so coding an entire site in php is not yet an option for me.
          I hope you get what i mean.

          If i name a site php and have some php script in it and the rest html i take it its no problem
          then? Have i got it right now?

          Thanks for your help

            No problem at all, the two work hand in hand.

            If you look at the source code for a php page in your browser all you'll see is HTML

              A file is a file; you could use .qqq extensions or .xyz extensions if you really wanted to.

              When a user types a URL into their browser (or clicks on a link), the browser simply requests that file from the server. As long as that file exists on the server - regardless of its file extension - the server will deliver it (and perform any preprocessing on it that you've configured, such as parsing PHP code in .php files).

              By the way, you've been saying "site" when you mean "page" - using more precise language will make it easier for others to help you.

              Good luck!

                Thanksalot guys, youre the pros. Im just starting to learn php, I have tried out
                some easy scripts and some flat file scripts and its working good so far.
                Im gonna try out my first php/msql script tomorrow so i probably be back for
                more help.

                  Write a Reply...