drfals1307 2015-10-24 15:20
浏览 63

表单操作下载php文件而不是

I have this form on my website:

<div class="searchBar">
    <form action="searchDB.php" method="get">
        <input type="text" class="searchBarInput" bdo dir="rtl" name="k">
        <input type="image" class="searchBarIcon" src="../images/searchBarIcon2.png" border="0" alt="Submit" />
    </form>
</div>

and when I press "enter" or press the icon. the searchDB.php file is being downloaded instead of running the php file..

here's the code inside the php(its only for checking the mechanics of the connection between php and HTML..)

<?php
echo"This is a php file!";
?>

PS Ive tried downloading WAMP and installing it, nothing heppend. and I follows a tutorial on youtube about how to install PHP on your computer, nothing changed there aswell.. anything I can do?

  • 写回答

1条回答 默认 最新

  • doubangzhang6992 2015-10-24 15:30
    关注

    Your PHP file is probably in the wrong folder or you are accessing it with a 'local file' URL that starts with file:// .(yes, that a different slash). Remember, PHP is a server-side language, it requires a "web server" to "serve" you pages, it's not like opening or running any file with any action like in Explorer. Typically, in WAMPP (or XAMPP), there is a htdocs folder in which you put all the web-serverable files. XAMPP already places some sample files. The URL will look like : "http:\locahost:nnn\index.php" where nnn is usually a port number, with index.php in the htdocs folder. Typically, you put your files in a subfolder inside htdocs, and include that in the URL.

    评论

报告相同问题?

悬赏问题

  • ¥15 livecharts wpf piechart 属性
  • ¥20 数学建模,尽量用matlab回答,论文格式
  • ¥15 昨天挂载了一下u盘,然后拔了
  • ¥30 win from 窗口最大最小化,控件放大缩小,闪烁问题
  • ¥20 易康econgnition精度验证
  • ¥15 msix packaging tool打包问题
  • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置