douzhan8652 2011-03-16 02:37
浏览 15
已采纳

调用PHP打印源,从另一个文件调用时不运行

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 
  • 写回答

5条回答 默认 最新

  • dongqiu3709 2011-03-16 03:39
    关注

    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. :-)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥15 怎样才能让鼠标沿着线条的中心线轨迹移动
  • ¥60 用visual studio编写程序,利用间接平差求解水准网
  • ¥15 Llama如何调用shell或者Python
  • ¥20 谁能帮我挨个解读这个php语言编的代码什么意思?
  • ¥15 win10权限管理,限制普通用户使用删除功能
  • ¥15 minnio内存占用过大,内存没被回收(Windows环境)
  • ¥65 抖音咸鱼付款链接转码支付宝
  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?