开发者

PHP Contact Form

My Contact form works fine but whe开发者_如何学JAVAn you press submit, it downloads the PHP File.

<form name="contactform" method="post" action="send_form_email.php"> 

And this is the submit button:

<input type="submit" name="button" class="button" value="Send">

If this is supposed to happened in offline mode then okay.


The "offline mode" is occurring because the PHP is being read directly by the web browser. You must put your PHP files in either a localhost or web host.


If by offline mode you simply mean you have opened the script in your browser directly from the file system then that is the expected behaviour as the PHP is not being run through it's parser.

You need a web server set up to serve .php scripts.

On the other hand, if this is being served by a web server then their is a problem with its configuration.


This should never happen, you php file should never be downloaded to clients computer. Just imagine a config file on your web server with the passwords and stuff.

You should check that you have php installed and that apache settings are correct.


The PHP is not being run through the PHP parser - or is being sent with headers to force download. Speak to the hosting provider.


What do you mean by "offline mode"?

Essentially what's happening here is that the web server being contacted in the HTTP POST isn't configured to process the PHP code. So it's just returning the requested file by default. You'll need to configure the web server to handle the PHP code accordingly, and this process varies between web servers (but generally includes installing PHP on the server).

It should also be noted that by not configuring the server properly you may be exposing a huge security risk. If people can download the PHP files directly then they can see the code that the server is supposed to be processing. Once you configure it to process that code, they'll have a copy of it and can exploit it. Even simpler, if the code contains any sensitive information (such as credentials to authenticate against a database) then you'd be exposing that information to the world.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜