Click to See Complete Forum and Search --> : Open/save .php file when clicked?


ecolodge
08-26-2006, 02:29 PM
Just trying to make a user registration page. First of all, I am using WAMP. But I dont think thats the problem. Second, my localhost works, and I even made a stupid Hello World test php file and that worked. So here's the problem.

After I enter information for the text fields in the registration form, i click submit and a box pops up asking me to open or save the PHP file. Why is it asking me this, why wouldnt it just run the dedicated PHP script?

Here's the form in the HTML page...

<form action="register.php" method="post">
<div align="right">Pick a Username:
<input type="text" name="username" size="50">
<br>
Pick a Password:
<input type="password" name="password" size="50">
<br>
Your Email:
<input type="text" name="email" size="50">
<br>
Age (#):
<input type="text" name="age" size="50">
<br>
Zipcode (5 digits):
<input type="text" name="zipcode" size="50">
<br>
Gender:
<select name="sex" size="1">
<option>Male</option>
<option>Female</option>
</select>
<br><br>
</div><p>
<div align="center">Registering with us is completely free. With registering with us, you agree and abide by the Privacy Policy and
Rules outlined when using the features of this site such as postings on message boards. </div>
<p align="center">
<input name="submit" type="submit" value="Sign Up">
</form>

any ideas? i even made a sign in script (as if there really was a user that could log in) and that does the same thing.

NogDog
08-26-2006, 06:01 PM
Does your web host actually support PHP? (It sounds like it considers .php to be an unknown file type, so is just serving up the source code file rather than parsing/compiling it and outputting the result.)

ecolodge
08-27-2006, 03:50 PM
well im just testing it on my own computer right now. also using firefox as my browser.

netbuddy
08-27-2006, 04:04 PM
if your testing on your computer then that would be the expected result because your not viewing the file via a web browser using the http protocol.

I would suggest that you grab one of the many hundreds of webservers that are free and install php and go for the tripple and mySql also.

Then you simply view your web pages with a web browser on http://127.0.0.1 or http://localhost

chesemonkyloma
08-27-2006, 11:36 PM
He said he was using WAMP... that's the combination of windows, apache, mysql, and php. You have to use http://localhost, not file://C: in your browser, also make sure that WAMPServer is running.

chesemonkyloma
08-27-2006, 11:38 PM
You also need to make sure the files are in the localhost directory, which is most likely C:/wamp/www/

ecolodge
08-28-2006, 03:42 PM
thanks for the continuing help. normaly i would post these problems on WAMP board but there are like 4 people there.

Now, yes all the services are running. And yes all my files are being stored in c:/WAMP/www folder.

If I type http://localhost/whatever.php it will run that script. For instance, I made the infamous "Hello World" test and it worked. I think WAMP is running correctly.

right now, the html code points to the file "register.php"

I changed that to http://localhost/register.php and an error message comes up. I even doubled checked with IE to no avail. I know its going to be something stupid. I keep thinking since I'm testing it on my computer, that the html coding needs to be different since it's "localhost"? It's like I can type it into the address bar, but whenever HTML is introduced it doesnt know what to do.

I dont know, I really dont think this should be this difficult. I like the continuing support though, maybe we can fix this!

ecolodge
08-28-2006, 03:50 PM
HEY HEY! figured it out.

WAMP can either be offline or online. I switched it to online (didnt think I needed to do this since I thought I was working offline anyways).

It works now.... but the HTML coding needs to work like this...

http://localhost/register.php

won't work otherwise. Now, one more quick question. When I want to go "live" and transfer my files to the online server..... what changes do I need to make in my code so the online server will know what to do? Can I still use localhost? or is that only on my machine?

THANKS!

netbuddy
08-28-2006, 04:12 PM
You will need to use the IP address that is assigned to your computer by the ISP that you use to connect to the internet with.

If you use relative addressing, that is the '/register.php' portion of the address, the '/' indicating the root, the rest the path to the folder or file to serve.

If you still have server issues, you could look online for another server like I originally suggested, your not the first person I have heard of with WAMP issues, theirs far easier systems to implement that an Apache system which IME is always problematic and the number of servers that I come across with issues all tend to be Apache installs, I have yet to come across an other server other than Apache with serving issues.