PHP file problem

I have a simple html form that asks for my name. It calls a simple php file that just echo’s the name back. Took code straight from a web site on how to do this. But when I enter my name and it submit, the browser shows website/handler.php but I get a 404 error. I have set up my system so that my html is under c:/Inetpub/wwwroot. The php file is in that directory also. My php software is in c:/Inetpub/php

Do I have things is the wrong place? All permissions are allowed, since this is just a test file

Post the code of your simple php file

Html code

Form

Enter your name

handler.php

Form <?php echo "

Hello " . $_POST["username"] . "

"; ?>

I was doing this to try and test my environment. php does work from the command prompt but I keep getting errors in browser execution.

What is the name of your PHP page?

If you create a page with the function,

<?php phpinfo(); ?>

Does it show anything?

Name is Drop2.htm

when i put your code in a file named testhandler.php, and put in my browser the website/testhandler.php I got a 404. So I figure it must be something in configuration or setup?

any ideas to try. thanks in advance

By the way, when i execute that from the command prompt, it works fine but then I have given the full directories to both PDP and PHP file. It also worked fine when both are in the same directory from the command prompt.

But never from the browser

Change

[php][/php]

to"

[php][/php]

Changed action in Drop2.htm to what you advised. Now I get a 405 error. POST is a defined action.

How does changing the html action to point to itself cause the handler.php to be called? is “handler” a set name that I should always use? Doesn’t the html take the input and then in effect call the php to display the hello message?

Thanks for your patience.

You are getting that error because html files cannot accept anything other than GET. This may be a stupid question, but is this running on IIS or an Apache web server?

IIS server. yes, I know I should use apache and I will as soon as I have time to convert my system to Linux

Change it to this…

[php][/php]

and rename the file to drop2.php, seems like you didn’t configure .htm to run PHP in IIS.

Sponsor our Newsletter | Privacy Policy | Terms of Service