PDA

View Full Version : sendresults.php doesnot send email opens another page on browser


varab
02-18-2011, 07:52 PM
Hi, I think I posted this in the wrong place the first time.
I am using Dreamweaver CS3 for the first time to create a web site. It has been successful so far, but I am having trouble with a customer response form that I created.
The problem is that when the form page is on the web, filling it and hitting the submit button seems to work. However, instead of processing the request and sending an email, the sendresults.php gets opened up as another web page. Also, no email gets sent as I thought the script would process. I used a script below:

<?php
//--------------------------Set these paramaters------------------------
// Subject of email sent to you.
$subject = 'Results from Customer Enquiry';
// Your email address. This is where the form information will be sent.
$emailadd = 'info@asvantech.com';
// Where to redirect after form is processed.
$url = 'confirmation.html';
// Makes all fields required. If set to '1' no field can not be empty. I
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.'">';
?>I have created a form with 5 fields instead of 4 as shown in the example. I do not think this should be a problem.

I am also interested in adding CAPTCHA on this form.

Any help or guidance would be very much appreciated.

Thanks,

Vara B

domedia
02-21-2011, 01:45 PM
However, instead of processing the request and sending an email, the sendresults.php gets opened up as another web page.
Check with your hosting company. PHP is probably not available on your hosting account.

Corrosive
02-21-2011, 02:31 PM
Check with your hosting company. PHP is probably not available on your hosting account.

Yup, agreed. If it opens the file you don't have PHP running.