xmlhttp get + innerHTML + php embedded coding

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • johnb773
    New Member
    • Sep 2010
    • 4

    xmlhttp get + innerHTML + php embedded coding

    I have a .txt file that has some PHP coding (<?php echo setUrlVariables (); ?>) embedded into it.

    It worked fine (the variables actually worked) when I had my PHP file 'include("myfil e.txt")' (treating the .txt file as part of the php scripting and not as plain text).

    Now, I have it retrieving the .txt file from an XMLhttp get request and including it with the document.all.di vID.innerHTML command.

    But now it treats the "<?php...." code in the .txt file as regular text when imported. Is there any way to make it recognize the php code as code instead of plain text??

    Thanks in advance for any advice!!

    -John
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    the easiest way would be to rename the file to .php, as this will trigger the PHP parser to process the file.

    Comment

    • johnb773
      New Member
      • Sep 2010
      • 4

      #3
      I couldn't just rename it to .php because it didn't have any headers in it. So I ended up adding a replace() command. Thanks for the suggestion though.

      Comment

      Working...