PHP and Javascript

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • french_roast@sbcglobal.net

    PHP and Javascript

    I have PHP 5 installed on my windows machine. I have a drop down menu
    that requires javascript. When I call <?php include "filename.p hp" ?>
    and rename my html file to .php, the Javascript doesn't run on the
    client. Is there some sort of setting required? Maybe a bug in php?
    Any information would be helpful.

  • fsidler@nospam.gmail

    #2
    Re: PHP and Javascript


    french_roast@sb cglobal.net wrote:
    I have PHP 5 installed on my windows machine. I have a drop down menu
    that requires javascript. When I call <?php include "filename.p hp" ?>
    and rename my html file to .php, the Javascript doesn't run on the
    client. Is there some sort of setting required? Maybe a bug in php?
    Any information would be helpful.
    To be hones, i don't exactly know what you mean, but let me tell you:
    PHP and JS are two very different things. PHP gets executed after the
    server recieved the request. It then sends you a plain HTML document.
    In that HTML document, the browser looks for initiation of JavaScripts.
    So, if a javascript is not executed, this means you have something
    wrong in your HTML or JavaScript code. It has nothing to do with PHP.
    Try pasting your scripts.

    Comment

    • french_roast@sbcglobal.net

      #3
      Re: PHP and Javascript


      fsidler@nospam. gmail wrote:
      french_roast@sb cglobal.net wrote:
      I have PHP 5 installed on my windows machine. I have a drop down menu
      that requires javascript. When I call <?php include "filename.p hp" ?>
      and rename my html file to .php, the Javascript doesn't run on the
      client. Is there some sort of setting required? Maybe a bug in php?
      Any information would be helpful.
      To be hones, i don't exactly know what you mean, but let me tell you:
      PHP and JS are two very different things. PHP gets executed after the
      server recieved the request. It then sends you a plain HTML document.
      In that HTML document, the browser looks for initiation of JavaScripts.
      So, if a javascript is not executed, this means you have something
      wrong in your HTML or JavaScript code. It has nothing to do with PHP.
      Try pasting your scripts.
      Pasting the scripts worked. It's strange that SCRIPT html tag didn't
      work with a PHP file under windows.

      Comment

      • Eric Farraro

        #4
        Re: PHP and Javascript

        This should work fine. View the source of the page after it has
        loaded, and see if you can see the script tags that should be present.

        french_roast@sb cglobal.net wrote:
        fsidler@nospam. gmail wrote:
        french_roast@sb cglobal.net wrote:
        I have PHP 5 installed on my windows machine. I have a drop down menu
        that requires javascript. When I call <?php include "filename.p hp" ?>
        and rename my html file to .php, the Javascript doesn't run on the
        client. Is there some sort of setting required? Maybe a bug in php?
        Any information would be helpful.
        To be hones, i don't exactly know what you mean, but let me tell you:
        PHP and JS are two very different things. PHP gets executed after the
        server recieved the request. It then sends you a plain HTML document.
        In that HTML document, the browser looks for initiation of JavaScripts.
        So, if a javascript is not executed, this means you have something
        wrong in your HTML or JavaScript code. It has nothing to do with PHP.
        Try pasting your scripts.
        >
        Pasting the scripts worked. It's strange that SCRIPT html tag didn't
        work with a PHP file under windows.

        Comment

        • Kimmo Laine

          #5
          Re: PHP and Javascript

          <french_roast@s bcglobal.netwro te in message
          news:1153939444 .760003.257120@ i3g2000cwc.goog legroups.com...
          >
          fsidler@nospam. gmail wrote:
          >french_roast@sb cglobal.net wrote:
          I have PHP 5 installed on my windows machine. I have a drop down menu
          that requires javascript. When I call <?php include "filename.p hp" ?>
          and rename my html file to .php, the Javascript doesn't run on the
          client. Is there some sort of setting required? Maybe a bug in php?
          Any information would be helpful.
          >To be hones, i don't exactly know what you mean, but let me tell you:
          >PHP and JS are two very different things. PHP gets executed after the
          >server recieved the request. It then sends you a plain HTML document.
          >In that HTML document, the browser looks for initiation of JavaScripts.
          >So, if a javascript is not executed, this means you have something
          >wrong in your HTML or JavaScript code. It has nothing to do with PHP.
          >Try pasting your scripts.
          >
          Pasting the scripts worked. It's strange that SCRIPT html tag didn't
          work with a PHP file under windows.
          >
          Well you have to remember that the following:

          <script language="php">
          echo 'Fred Flintstone';
          </script>

          is perfectly valid php syntax, script tag can be used instead of <?php ?>.
          Make sure you've got proper attributes in your script tag,
          type="text/javascript" language="javas cript" so php won't mistake it for
          javascript.

          --
          "Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
          http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis
          spam@outolempi. net || Gedoon-S @ IRCnet || rot13(xvzzb@bhg byrzcv.arg)


          Comment

          Working...