PHP Form on Intranet page won't work

I have php forms on all of my websites that work fine, but when I try to use the sendresults.php on my intranet the submit button attempts to Open/Save the file instead of performing the actions in the PHP and emailing it to me.
But, when I post the same exact html and php file on the internet, it works fine. What do I need to tweak to get it to work on my intranet?

Here’s a summary of the html, without the blah blah blah…

.....(blah blah blah)

And here is the php

<?php $subject = 'Request for Additional Training'; $emailadd = '[email protected]'; $url = '\\server01\intranet\index1.html'; $req = '1'; $text = "Additional Training Request:\n\n"; $space = ' '; $line = ' '; $nm=gethostbyaddr($REMOTE_HOST); foreach ($_POST as $key => $value) { if ($req == '1') { if ($value == '') {echo "$key is empty";die;} } $j = strlen($key); if ($j >= 20) {echo "Name of form element $key cannot be longer than 20 characters";die;} $j = 20 - $j; for ($i = 1; $i <= $j; $i++) {$space .= ' ';} $value = str_replace('\n', "$line", $value); $conc = "{$key}:$space{$value}$line"; $text .= $conc; $space = ' '; } mail($emailadd, $subject, $text, 'From: '.$emailadd.''); $email = $_POST['Email']; $subject = 'Training Will Be Scheduled Shortly'; $text = 'generic text emailed to submitter '; mail($email, $subject, $text, 'From:'.$emailadd.''); echo ''; ?>

Can someone please help me???

Do you have web server installed and running (i.e. Apache, IIS)? Is PHP installed and corresponding handler & mime type are configured in web server?

Bare with me, as I am not a pro at this.
What do you mean webserver installed and running? We have had our intranet (full of html webpages and resources) running and working fine for the past 6 years.

Also, regarding installing PHP and coresponding handler/mime type configure…um, huh? When I put the php on our website, I didn’t have to do any of that so I figure by putting the same script on our internal intranet that we woudln’t need to either.

There must be web server set up and running if you want to execute php on your local computer or intranet. Try to create small file (name it info.php) and put just this code:
[php]<?php phpinfo() ?>[/php]

and open it in your browser.
This will show you if php is available on your environment.

When I create a php file on my server with that code and try to openin IE, it gives me a window: “Do you want to open or save this file?” When I click “open”, it thinks for a moment, opens a blank browser window, then brings me back to window: “Do you want to open or save this file?”.

So, I am assuming PHP is not available on my environment. What do I need to do to make it available?

Try to set up WAMP, it includes all what you need to run php under Windows.

Sponsor our Newsletter | Privacy Policy | Terms of Service