Search code examples
phphtmlcoda

Call to PHP prints source, doesn't run when called from another file


I have a quick question that I can't figure out. I've tried searching Google and following examples, but I can't find anything.

I have an HTML form that I'm trying to process with a PHP file, but when I submit the form, it merely prints the source of the PHP file, it doesn't execute it. If I run the PHP file by itself (not indirectly through the HTML button), it works fine.

HTML form header:

<form id="registrationform" name="registrationform" method="post" action="processregistration.php"> 

Submit button:

<button type="submit" value="Submit" >Create</button>

The PHP form is just <?php print "Hello"; /? Again, it runs fine if I just run the PHP file, but prints the PHP file (doesn't run) when it gets called through the HTML form.

Any help is appreciated.

edit-Running locally through Coda

edit-Here is the output that I'm getting:

Output when the PHP is called through an HTML action:

</php
print "Hello";
?>

Output when I run the PHP directly through Coda:

Hello 

Solution

  • Line #19 from Coda 1.6 Release notes:

    Coda no longer tries to locally preview a remote PHP file while editing/previewing

    Listed under "Improvement" - doubt they brought it back for the 1.7 release.

    I'm running Apache2/PHP5 10.5.8 OS X (no problem reproducing your issue with Coda) Even when running my form.html and post.php files from /Library/WebServer/Documents folder.

    My sample files work fine in the Apache env....I just needed to run them through Coda to "break" them. :-)