刚上手PHP,最基本问题

WBOY
Release: 2016-06-23 14:26:56
Original
1110 people have browsed it

我用的是wampserver,然后就可以写.php文件了。
比如可以写a.php文件,然后在浏览器输入 "localhost/a.php" 然后就正常运行。
但是我想仿照w3cschool上这个例子:
建立一个html文件如下:




Name: 

E-mail: 







然后建立一个php文件如下:



Welcome 

Your email address is: 




我把他们放到了我的www目录下,当我打开html文件的时候填写表格,填写完点击sumbit按钮,就会跳转到
file:///C:/wamp/www/php/welcome.php
显示不了传送的信息。如果我手动到 localhost/php/welcome.php就会报错说变量不存在(这是一定,因为没有传过来)。不知道怎么才能让他跳转到正确的localhost?

请问前辈,如何才能让数据正确在html文件和php文件之间传送呢?多谢!

回复讨论(解决方案)

Name: 
E-mail: 

上面的代码改为:

Name: 
E-mail: 

看看

file:///C:/wamp/www/php/welcome.php ???
你在桌面用浏览器打开的你的html文件?

你需要在浏览器地址栏输入: localhost/php/你的html文件

访问html页面的方式和访问php页面访问方式一样,都是http://localhost/xx.html,而不是双击直接打开访问

楼主请问你是用IE打开的吗?

file:///C:/wamp/www/php/welcome.php ???
你在桌面用浏览器打开的你的html文件?

你需要在浏览器地址栏输入: localhost/php/你的html文件

原来需要用localhost打开,明白啦~

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!