php email form help please

Hi,
just a novice webmaster trying to be smart, copy a form, adjust it and add a bit of specifics for our charity and think it works. But whatever I try, I continue getting the “HTTP500 Page cannot be displayed” error page in my browser.

Anyone willing to see if there are some obvious stupidities from my side? I am clueless as to what would be wrong

Thanks!

<?php

$ip = $_POST[‘ip’];
$httpref = $_POST[‘httpref’];
$httpagent = $_POST[‘httpagent’];
$firstname = $_POST[‘firstname’];
$surname = $_POST[‘surname’];
$street = $_POST[‘street’];
$postcode = $_POST[‘postcode’];
$city = $_POST[‘city’];
$country = $_POST[‘country’];
$phone = $_POST[‘phone’];
$email = $_POST[‘email’];
$start_day = $_POST[‘start_day’];
$start_month = $_POST[‘start_month’];
$start_year = $_POST[‘start_year’];
$gender = $_POST[‘gender’];
$age_group = $_POST[‘age_group’];
$childname = $_POST[‘childname’];
$which_home = $_POST[‘which_home’];
$interval = $_POST[‘interval’];
$currency = $_POST[‘currency’];
$amount = $_POST[‘amount’];
$comments = $_POST[‘comments’];

/* if (eregi(‘http:’, $city)) */

if ( ereg( “[
]”, $firstname ) || ereg( “[
]”, $email || eregi(“http:”, $city)) {
die (“Do NOT try that! ! “);
}
if(!$email == “” && (!strstr($email,”@”) || !strstr($email,".")))
{
echo "<h2>Use the Back button - Enter valid e-mail</h2>
";
$badinput = "<h2>Feedback was NOT submitted</h2>
";
echo $badinput;
die ("Go back! ! ");
}

if(empty($firstname) || empty($surname) || empty($start_day) || empty($start_month) || empty($start_year) || empty($street) || empty($postcode) || empty($city) || empty($country) || empty($phone) || empty($email) || empty($gender) || empty($age_group) || empty($interval) || empty($currency) || empty($amount)) {
echo "<h2>Use the Back button - Please fill in all required fields, marked with an asterix</h2>
";
die ("Use back! ! ");
}

$todayis = date(“l, F j, Y, g:i a”) ;

$subject = “LIA Child Sponsorship_Form_”;

$message = " $todayis

Child Sponsorship form

Submitted by: $firstname $surname

From: $street $postcode $city $country

Who can be reached through:

Phone number: $phone

Email: $email

$firstname hereby confirm interest in sponsoring a child within the care of Light in Africa.

Preference is for a $gender of age group $age_group

When possible, $firstname would like to sponsor $childname from $which_home however, it is

understood that LIA will consult with $firstname $lastname about the final child selection.

$firstname $lastname expects to start the unsollicited sponsorship effective: $start_day $start_month $start_year

and forsees to contribute $currency $amount on a $interval basis.

$firstname $lastname has the right to alter the contribution and/or withdraw from the program at

any time, but will duly notify Light in Africa of intended changes prior to their effective date.

Other comments from $firstname:

$comments

$firstname $lastname understands that all sponsorship finances help to support all the childrens’ accommodation,

provision of a nutritionally balanced diet and all educational and medical expenses of the Light in Africa programs.

This data was provided by $firstname $lastname through the online LIA Child Sponsorship webform.

Additional System Info : IP = $ip

Browser Info: $httpagent

Referral : $httpref

";

$from = “From: $email”;
$cc = “Cc: $email”;
$to = "webmaster@lightinafrica.org"

mail($to, $subject, $message, $from
$email);

?>

That’s normally when you server does not support dynamic content .

Is the server set up to serve up PHP content ?

few errors in their , done what I can but without passing variables to it can’t say for sure plus I’m no pro :wink:

amended version… you can see initial output that the script is running here http://www.brittech.co.uk/testit.php

moved some varibles from the bottom of the script to the top.


<?

$ip = $_POST['ip']; 
$httpref = $_POST['httpref']; 
$httpagent = $_POST['httpagent']; 
$firstname = $_POST['firstname']; 
$surname = $_POST['surname'];
$street = $_POST['street']; 
$postcode = $_POST['postcode'];
$city = $_POST['city'];
$country = $_POST['country'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$start_day = $_POST['start_day'];
$start_month = $_POST['start_month'];
$start_year = $_POST['start_year'];
$gender = $_POST['gender'];
$age_group = $_POST['age_group'];
$childname = $_POST['childname'];
$which_home = $_POST['which_home'];
$interval = $_POST['interval'];
$currency = $_POST['currency'];
$amount = $_POST['amount'];
$comments = $_POST['comments'];
$from = "From: $email";
$cc = "Cc: $email";
$to = "webmaster@lightinafrica.org";

/* if (eregi("http:", $city)) */

if ( ereg( "[
]", $firstname ) || ereg( "[
]", $email )  || eregi("http:", $city))
{
die ("Do NOT try that! ! ");
}
if(!$email == "" && (!strstr($email,"@") || !strstr($email,"."))) 
{
echo "<h2>Use the Back button - Enter valid e-mail</h2>
"; 
$badinput = "<h2>Feedback was NOT submitted</h2>
";
echo $badinput;
die ("Go back! ! ");
}

if(empty($firstname) || empty($surname) || empty($start_day) || empty($start_month) || empty($start_year) || empty($street) || empty($postcode) || 

empty($city) || empty($country) || empty($phone) || empty($email) || empty($gender) || empty($age_group) || empty($interval) || empty($currency) || 

empty($amount)) {
echo "<h2>Use the Back button - Please fill in all required fields, marked with an asterix</h2>
"; 
die ("Use back! ! ");
}

$todayis = date("l, F j, Y, g:i a") ;

$subject = "LIA Child Sponsorship_Form_"; 

$message = " $todayis 

Child Sponsorship form 

Submitted by: $firstname $surname 
 
From: $street $postcode $city $country 

Who can be reached through:

Phone number: $phone 

Email: $email 



$firstname hereby confirm interest in sponsoring a child within the care of Light in Africa. 

Preference is for a $gender of age group $age_group 



When possible, $firstname would like to sponsor $childname from $which_home however, it is 

understood that LIA will consult with $firstname $lastname about the final child selection. 


$firstname $lastname expects to start the unsollicited sponsorship effective: $start_day $start_month $start_year 

and forsees to contribute $currency $amount on a $interval basis. 



$firstname $lastname has the right to alter the contribution and/or withdraw from the program at 

any time, but will duly notify Light in Africa of intended changes prior to their effective date. 



Other comments from $firstname: 

$comments 



$firstname $lastname understands that all sponsorship finances help to support all the childrens' accommodation, 

provision of a nutritionally balanced diet and all educational and medical expenses of the Light in Africa programs.


This data was provided by $firstname $lastname through the online LIA Child Sponsorship webform. 







Additional System Info IP : $ip 

Browser Info : $httpagent 

Referral : $httpref ";

mail($to,$subject,$message,$from."
".$email);
?>

Thanks so much PMM
the server supports it and the code now works
after comparison it seems a few quotation marks and one semi colon did the trick
how clumsy, but after having looked at it for some hours I did not see clearly anymore

Thanks! and Happy New Year!
Paul