2013-01-08 4 views
0

이 스크립트를 사용하고 있습니다. http://www.quackit.com/html/codes/html_form_to_email.cfmSendmail 양식 피드백, 변수 선언?

기본으로 잘 작동합니다.

하지만 난 몇 가지 추가 변수를 추가 한을 추천했습니다 :

/* 
This next bit loads the form field data into variables. 
If you add a form field, you will need to add it here. 
*/ 
$namn = $_REQUEST['namn'] ; 
$telefonnummer = $_REQUEST['telefonnummer'] ; 
$email_address = $_REQUEST['email_address'] ; 
$comments = $_REQUEST['comments'] ; 

내 문제는 내가 그들을 보내지는 전자 메일에 표시 얻을 관리하지 못할 것입니다. 내가 시도

이처럼이 포함

mail("$webmaster_email", "Feedback Form Results", 
    $namn, $email, $telefonnummer, $comments, "From: $email_address"); 

이를 :

mail("$webmaster_email", "Feedback Form Results", 
    $comments, "From: $email_address"); 
    $email, ;) 
    $telefonnummer, :) 

밖으로 작동하지, 당신은 내가 잘못된 일을 어떤 생각을 가지고 있습니까는? http://php.net/manual/en/function.mail.php

당신이 있어야합니다 :

답변

0

귀하의 코드가 mail() 정의와 일치하지 않는

mail($webmaster_email, "Feedback Form Results", "$namn, $email, $telefonnummer, $comments", "From: $email_address"); 
+0

감사합니다!^_^ –

0

mail() 기능에서 봐를, 그것은 네 개의 매개 변수

mail($to, $subject, $message, $headers); 

그래서 당신이해야을 받아 코드를 변경하여 이런 식으로 보입니다.이 ne를 추가 한 형식으로 모든 것을 올바르게 처리했다고 생각하면됩니다. 귀하의 메시지가 경우에 올바르게 표시되도록 w 필드

$message=$namn.','. $email.','. $telefonnummer.','. $comments; 
mail($webmaster_email, "Feedback Form Results", $message, "From: {$email_address}"); 

은 또한 당신은 php.net에서이 예를 살펴, 그것은 내부의 HTML을 가지고 헤더 (등 매개 변수)에 몇 가지 추가 정보가 필요할 수 있습니다

// To send HTML mail, the Content-type header must be set 
$headers = 'MIME-Version: 1.0' . "\r\n"; 
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; 

// Additional headers 
$headers .= 'To: Mary <[email protected]>, Kelly <[email protected]>' . "\r\n"; 
$headers .= 'From: Birthday Reminder <[email protected]>' . "\r\n"; 
$headers .= 'Cc: [email protected]' . "\r\n"; 
$headers .= 'Bcc: [email protected]' . "\r\n"; 

// Mail it 
mail($to, $subject, $message, $headers); 
+0

감사합니다 이것은 매우 유용한 정보입니다!^_^ –

0

PHP mail을 볼 필요가 있습니다. 많은 매개 변수를 사용할 수 있습니다.

기본 사용법은 다음과 같습니다 mail($to, $subject, $message, $additional_headers);

시도 : 이것은 매우 유용한 정보했다

/* 
This next bit loads the form field data into variables. 
If you add a form field, you will need to add it here. 
*/ 
$namn = $_REQUEST['namn'] ; 
$telefonnummer = $_REQUEST['telefonnummer'] ; 
$email_address = $_REQUEST['email_address'] ; 
$comments = $_REQUEST['comments'] ; 

$message = 'namn: ' . $namn . ' telefonnummer: ' . $telefonnummer . ' email_address: ' . $email_address . ' comments: ' . $comments; 

mail($webmaster_email, "Feedback Form Results", $message, "From: $email_address"); 
+0

감사합니다 이것은 매우 유용한 정보입니다!^_ ^ –