开发者

form trying to open php file

开发者 https://www.devze.com 2023-01-05 03:35 出处:网络
I\'m new to php and I have the following form in my html file: <form id=\"log开发者_Python百科inForm\" action=\"login.php\" method=\"post\">

I'm new to php and I have the following form in my html file:

<form id="log开发者_Python百科inForm" action="login.php" method="post">
    <label for="username">Username:</label>
    <div>
        <input type="text" name="username" maxlength="255"/>
    </div>
    <label for="password">Password:</label>
    <div>
        <input type="password" name="password" maxlength="255"/>
    </div>
    <div class="buttonDiv">
        <input type="submit" name="loginButt" value="Login"/>
    </div>          
</form>

Why does it try to open my php file when I try to run it? Open as in firefox opens a window asking me if I want to save or open the file.

Thanks


Because you're opening the HTML file directly in your browser or your web server does not handle PHP files.

For Windows, you might want to try this.


Make sure that you have PHP enabled. May sound stupid, but it's probably the solution.


Probably you don't have the php server running. The form page displays correctly in the browser since the page file is a normal html file.

You'll see that if you try to execute the php file directly from the browser the same thing will happen.

An other thing that could be happening is that, in case you are using apache server, you are not loading the php apache module.


Save the HTML file with the extension .php. This will do it.

0

精彩评论

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