View Full Version : PHP script Form not executing

05-17-2006, 04:37 PM
Hello everyone,

I having problems with a script executing properly on my IIS 6 Webserver. PHP is installed manually as recommended from http://www.php.net and I have followed the directions on moving the PHP files to the correct directories and adding the Web Server extensions. The problem is this. Our Webmaster createda form using dreamweaver and is trying to use this PHP script to execute the options set forth in the script. Here is the script in question I got this from this website.


//--------------------------Set these paramaters--------------------------

// Subject of email sent to you.
$subject = 'Residential Repair Request';

// Your email address. This is where the form information will be sent.
$emailadd = 'oceans@aimtree.org';

// Where to redirect after form is processed.
$url = 'http://www.aimtree.org/pwthankyou.htm';

// Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
$req = '0';

// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
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.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';

Evertime we go to use the Submit function of this form it produces this same code in the browser. This tells me the script is not executing but I don't know why. The phpinfo() files executes correctly on the server and I can see all the configuration settings as it says I should. Don't know if everything is correct in the php.ini file though. I am gasping for help here as I need to get these forms working by a deadline. Also is there anything I need to do to make this talk to our mailserver. The Webserver resides in the DMZ and the mailserver is on our internal network. :cry: Any help in this matter is greatly appreciated. Thanking you in advance