Page 1 of 1

My hair is turning gray

Posted: Wed Apr 28, 2010 7:45 am
by tossan123
First of all hello to all,
i have a problem with my php code :banghead: .
I´ve managed to install php on my webserver which is running Tomcat 5.5.
i´m trying to use a form that i have on one of the pages, when i send the form the only thing i get is a blank page with
"; } else{ echo ""; } ?>
,
can someone help me please?

Here is the code in the .php file.

Code: Select all

<?php
 
	$emailSubject = 'Meddelande från kontaktformuläret på http://www.mysite.se!';
	$emailTo = 'info@mysite.se';
	
	$NamnField = $_POST['Namn'];
	$FöretagField = $_POST['Företag'];
	$TelefonField = $_POST['Telefon'];
	$EpostField = $_POST['Epost'];
	$MeddelandeField = $_POST['Meddelande'];
	
	$Body = "";
	$Body .= "Namn: ";
	$Body .= $NamnField;
	$Body .= "\n";
	$Body .= "Företag: ";
	$Body .= $FöretagField;
	$Body .= "\n";
	$Body .= "Telefon: ";
	$Body .= $TelefonField;
	$Body .= "\n";
	$Body .= "Epost: ";
	$Body .= $EpostField;
	$Body .= "\n";
	$Body .= "Meddelande: ";
	$Body .= $MeddelandeField;
	$Body .= "\n";

	$success = mail($emailTo, $emailSubject, $Body);
	
	if ($success){
  echo "<meta http-equiv=\"refresh\" content=\"0;URL=thanks.html\">";
}
else{
  echo "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
}
?>
Best Regards Fredrik

Re: My hair is turning gray

Posted: Wed Apr 28, 2010 11:47 am
by Reviresco

Code: Select all

if ($success){
  header("Location: http://www.mysite.se/thanks.html");
}
else{
  header("Location: http://www.mysite.se/error.html");
}