2016-09-26 4 views
-2

누구든지 나를 도울 수 있습니다! 이 PHP 내가 (오류) 다이를 변경하는 경우, 페이지 나 그에게 말한다, 이메일을 보내지 않습니다, 내 웹에서 작동하지 않습니다 .. enter image description herePHP 폼 연락처, 체크 박스, 오류 500

드 PHP는 액션이 ​​있습니다

<?php 
$name = $_POST['name']; 
$lastname = $_POST['lastname']; 
$email = $_POST['mail']; 
$Title = $_POST ['position/title']; 
$company = $_POST ['company']; 
$location = $_POST ['location']; 
$telephone = $_POST['telephone']; 
$services = $_POST['services']; 
$string = join(" \r\n ", $services); 
$timeframe = $_POST['timeframe']; 
$comments = $_POST['comments']; 
$learn = $_POST['learn']; 
     $message = '<html><body>'; 
     $message .= '<img src="http://www.corbisglobal.com/assets/web/img/contact-CG-logo.png" />'; 
     $message .= '<table rules="all" style="border-color: #666; border : 1px;" cellpadding="10">'; 
     $message .= "<tr style='background: #ddd;'><td><strong>Name:</strong> </td><td>" . strip_tags($_POST['name']) . "</td></tr>"; 
     $message .= "<tr style='background: #eee;'><td><strong>Lastname:</strong> </td><td>" . strip_tags($_POST['lastname']) . "</td></tr>"; 
     $message .= "<tr><td><strong>Email:</strong> </td><td>" . strip_tags($_POST['mail']) . "</td></tr>"; 
     $message .= "<tr><td><strong>Title/Position:</strong> </td><td>" . strip_tags($_POST['position/title']) . "</td></tr>"; 
     $message .= "<tr><td><strong>Company:</strong> </td><td>" . strip_tags($_POST['company']) . "</td></tr>"; 
     $message .= "<tr><td><strong>Location:</strong> </td><td>" . strip_tags($_POST['location']) . "</td></tr>"; 
     $message .= "<tr><td><strong>Services:</strong> </td><td>" . join(" \r\n, ", $services) . "</td></tr>"; 
     $message .= "<tr><td><strong>Timeframe:</strong> </td><td>" . strip_tags($_POST['timeframe']) . "</td></tr>"; 
     $message .= "<tr><td><strong>Learn about Corbis:</strong> </td><td>" . strip_tags($_POST['learn']) . "</td></tr>"; 
     $message .= "<tr><td><strong>Comments:</strong> </td><td>" . strip_tags($_POST['comments']) . "</td></tr>"; 
     $message .= "</table>"; 
     $message .= "</body></html>"; 
$recipient = "[email protected]"; 
$subject = "Contact Form from CorbisGlobal Web"; 
$mailheader .= "MIME-Version: 1.0\r\n"; 
$mailheader .= "From: " . strip_tags($_POST['mail']) . "\r\n"; 
$mailheader .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; 
mail($recipient, $subject, $message, $mailheader) or die (error); 
header("Location: thankyou.php"); 
exit; 
?> 
+4

A 500 오류 = 서버 오류 (일부 PHP 오류). 오류 로그를 확인하거나 디스플레이 오류를 켜면 우리와 공유 할 수있는 적절한 오류 메시지가 나타납니다. 여기에 그것을 켜는 방법을 볼 수 있습니다 : http://stackoverflow.com/questions/1053424/how-do-i-get-php-errors-to-display –

+3

Btw, 왜 모든 게시물 값을 변수에 저장하고 있습니까? , 그리고 어쨌든 post 변수를 나중에 사용 하시겠습니까? –

답변

4

귀하의 오류가 중간 줄에 아마도 : 당신이 그것에 더 많은 텍스트를 추가되기 전에

$subject = "Contact Form from CorbisGlobal Web"; 
$mailheader .= "MIME-Version: 1.0\r\n"; 
$mailheader .= "From: " . strip_tags($_POST['mail']) . "\r\n"; 

당신은 변수 $mailheader를 작성하지 않았다.

오류보고 기능을 설정하면 대부분의 문제를 해결하는 데 도움이되는 의미있는 오류 메시지가 표시됩니다.

mail($recipient, $subject, $message, $mailheader) or die (error); 

or die (error), 당신은 아마도 error 상수를 정의하지 않았고, 당신이 우리를 보여 코드에서이 이름을 가진 변수가 없다 :

또한, 당신은이 일을하고 있습니다. mail 함수가 입력을 허용했는지 확인하려면 다음을 수행하십시오.

if (mail($recipient, $subject, $message, $mailheader)){ 
    header("Location: thankyou.php"); 
} 
else{ 
    die("Error sending email"); 
} 
+0

예, 아마도 그럴 것입니다 (OP가 이것을 생략하지 않았다고 가정) –

+0

나는 그가 전체 코드를 붙여 넣었을 것이라고 생각합니다. – Phiter

+0

나는 그것이 HTTP 500 오류로 이어질 것이라고 심각하게 의심합니다. – jeroen