Nasao sam 100 primera na google i svi ovako rade, i sve sam izmenio, sve sam pokusao, ali ne vredi... ceo dan....
Code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>My email form</title>
</head>
<body>
<?php
if(isset($_POST['email'])) {
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "
[email protected]";
$email_subject = "My Text";
function died($error) {
// your error code can go here
echo "We are very sorry, but there were error(s) found with the form you submitted. ";
echo "These errors appear below.<br /><br />";
echo $error."<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die();
}
// validation expected data exists
if(!isset($_POST['name']) ||
!isset($_POST['email']) ||
!isset($_POST['telephone'])) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$name = $_POST['name']; // required
$email_from = $_POST['email']; // required
$telephone = $_POST['telephone']; // not required
$referal = $_POST['referal'];
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "Client details below.\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "First Name: ".clean_string($name)."\n";
$email_message .= "Email: ".clean_string($email_from)."\n";
$email_message .= "Telephone: ".clean_string($telephone)."\n";
$email_message .= "Referal: ".clean_string($referal)."\n";
// message
$message = '<html><body>';
$message .= '<h1>Hello, World!</h1>';
$message .= '</body></html>';
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-2' . "\r\n";
@mail($email_to, $email_subject, $email_message, $headers);
@mail($email_from, "Confirmation", $message, 'From:
[email protected]');
if (isset($_POST['submitform']))
{
?>
<script type="text/javascript">
window.location = "http://www.bbc.com";
</script>
<?php
}
?>
<!-- include your own success html here header("Location: thankyou.html"); -->
Thank you for contacting us. We will be in touch with you very soon.
<?php
}
?>
</body>
</html>