2014-07-14 2 views
-2

"문의하기"페이지를 만들고 싶지만 "보내기"버튼을 누르면 내용이없는 빈 "null"메일이 생성됩니다. 해당 이메일에는 "보낸 사람", "메시지"또는 "제목"이 없으므로 문제를 찾을 수 없습니다. 여기 연락처 양식에서 "null"메시지를 보냅니 까?

내 코드는, contact.php 모습입니다 :

<table width="400" border="0" align="center" cellpadding="3" cellspacing="1"> 
<tr> 
<td><strong>Contact Form </strong></td> 
</tr> 
</table> 
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1"> 
<tr> 
<td><form name="form1" method="post" action="send_contact.php"> 
<table width="100%" border="0" cellspacing="1" cellpadding="3"> 
<tr> 
<td width="16%">Subject</td> 
<td width="2%">:</td> 
<td width="82%"><input name="subject" type="text" id="subject" size="50"></td> 
</tr> 
<tr> 
<td>Detail</td> 
<td>:</td> 
<td><textarea name="detail" cols="50" rows="4" id="detail"></textarea></td> 
</tr> 
<tr> 
<td>Name</td> 
<td>:</td> 
<td><input name="name" type="text" id="name" size="50"></td> 
</tr> 
<tr> 
<td>Email</td> 
<td>:</td> 
<td><input name="customer_mail" type="text" id="customer_mail" size="50"></td> 
</tr> 
<tr> 
<td>&nbsp;</td> 
<td>&nbsp;</td> 
<td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td> 
</tr> 
</table> 
</form> 
</td> 
</tr> 
</table> 

send_contact.php :

<?php 

// Contact subject 
$subject ="$subject"; 

// Details 
$message="$detail"; 

// Mail of sender 
$mail_from="$customer_mail"; 

// From 
$header="from: $name <$mail_from>"; 

// Enter your email address 
$to ='[email protected]'; 
$send_contact=mail($to,$subject,$message,$header); 

// Check, if message sent to your email 
// display message "We've recived your information" 
if($send_contact){ 
echo "We've recived your contact information"; 
} 
else { 
echo "ERROR"; 
} 
?> 

답변

0

안녕하세요 send_contact.php

// Contact subject 
$subject ="$subject"; 

// Details 
$message="$detail"; 

// Mail of sender 
$mail_from="$customer_mail"; 
의 첫 번째 라인을 변경하려고

대상 :

// Contact subject 
$subject = $_POST['subject']; 

// Details 
$message= $_POST['details']; 

는하지만 난 당신이 하나를 시도하는 것이 좋습니다 :

0

같은 것을 원한다.

$subject ="$subject"; 

는 다른 바르와 함께

$subject = $_POST['subject']; 

이어야한다. 어떻게 진행되고 있는지 더 잘 이해할 수 있도록 양식 자습서 및 POST/GET/REQUEST를 살펴보십시오.