My hair is turning gray

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tossan123
Forum Newbie
Posts: 1
Joined: Wed Apr 28, 2010 6:51 am

My hair is turning gray

Post 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
Reviresco
Forum Contributor
Posts: 172
Joined: Tue Feb 19, 2008 4:18 pm
Location: Milwaukee

Re: My hair is turning gray

Post by Reviresco »

Code: Select all

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