Page 2 of 2
Posted: Sat Jul 15, 2006 11:24 am
by Chris Corbyn
Slightly off-topic and horsing back to the initial post but
Code: Select all
$z++;$b[$z]="realname :".$realname."\n";
Could be written as:
Code: Select all
$b[++$z]="realname :".$realname."\n";
Re: PHP Mailform dosen't work anymore
Posted: Sat Jul 15, 2006 11:36 am
by aerodromoi
oliver23 wrote:
Perfekt!
One more question, is it possible to forward it to another site (danke.html) if the sending was okay? A redirect instead of
Code: Select all
<?php
// fetch the variables from the post array
$firma = $_POST['firma'];
$realname = $_POST['realname'];
$senderemail = $_POST['senderemail'];
$recipient = "name@domain.ch";
$subject = "Kontaktformular";
$letter = "Email: " . $senderemail . "\n";
$letter .= "Firma: " . $firma . "\n";
$letter .= "Name: " . $realname;
if (ereg('(cc\:|bcc\:|to\:)', strtolower($senderemail))){
$header = "X-Mailer: PHP " . phpversion();
}
else{
$header = "From: " . $senderemail;
}
// check whether all fields have been filled in
if (empty($firma) || empty($realname) || empty($senderemail)){
print("Sorry, all fields are required!");
}
else{
$result = @mail($recipient,$subject,$letter,$header);
$result ? header("Location: http://www.anonexistantdomain.com/") : print ("An error occurred!");
}
?>
btw: Any output before the header function will produce errors.
Posted: Sat Jul 15, 2006 11:42 am
by aerodromoi
d11wtq wrote:Slightly off-topic and horsing back to the initial post but
Code: Select all
$z++;$b[$z]="realname :".$realname."\n";
Could be written as:
Code: Select all
$b[++$z]="realname :".$realname."\n";
You must be flabbergasted that there are still people out there who use the mail() function
