2011-12-24 7 views
0

양식 및 PHP 처리 파일이 있는데 사용자 입력 변수가 전자 메일 양식 결과에 나타나지 않는 것을 제외하면 모든 것이 잘 작동하는 것 같습니다. 내가 수행 한 연구 (저는 PHP 초보자입니다.)에서 내 스크립트가 HTTP_POST_VARS를 사용하고 내 클라이언트의 서버가 전역 변수를 사용하지 않기 때문에이 스크립트를 추측하고 있습니다. 그들은 최근 Godaddy Windows에서 Godaddy Linux 호스팅으로 전환했습니다.PHP 양식 메일 및 레지스터 전역

<?php 
     // where is your config file stored? 
include ("ajaxSubmit.php"); 

    // CLIENT INFORMATION 

$Contactname = $HTTP_POST_VARS['Contactname']; 
$email = $HTTP_POST_VARS['email']; 
$Contacttitle = $HTTP_POST_VARS['Contacttitle']; 
$Business = $HTTP_POST_VARS['Business']; 
$Address = $HTTP_POST_VARS['Address']; 
$City = $HTTP_POST_VARS['City']; 
$State = $HTTP_POST_VARS['State']; 
$Zip = $HTTP_POST_VARS['Zip']; 
$Phone = $HTTP_POST_VARS['Phone']; 
$Fax = $HTTP_POST_VARS['Fax']; 
$product_desc = $HTTP_POST_VARS['product_desc']; 
$delivery = $HTTP_POST_VARS['delivery']; 
$sku = $HTTP_POST_VARS['sku']; 
$annualturns = $HTTP_POST_VARS['annualturns']; 
$seasonal = $HTTP_POST_VARS['seasonal']; 
$minmaxpallet = $HTTP_POST_VARS['minmaxpallet']; 
$avgpalletval = $HTTP_POST_VARS['avgpalletval']; 
$avgpalletwt = $HTTP_POST_VARS['avgpalletwt']; 
$maxpalletht = $HTTP_POST_VARS['maxpalletht']; 
$casesperpallet = $HTTP_POST_VARS['casesperpallet']; 
$unitweight = $HTTP_POST_VARS['unitweight']; 
$reqlotnumctrl = $HTTP_POST_VARS['reqlotnumctrl']; 
$freightclass = $HTTP_POST_VARS['freightclass']; 
$hazardclass = $HTTP_POST_VARS['hazardclass']; 
$barcodes = $HTTP_POST_VARS['barcodes']; 
$avgupsfedex = $HTTP_POST_VARS['avgupsfedex']; 
$avgorderweight = $HTTP_POST_VARS['avgorderweight']; 
$ordersending = $HTTP_POST_VARS['ordersending']; 
$custpickups = $HTTP_POST_VARS['custpickups']; 
$flatfiles = $HTTP_POST_VARS['flatfiles']; 
$shrinkwrap = $HTTP_POST_VARS['shrinkwrap']; 
$repack = $HTTP_POST_VARS['repack']; 
$specialreq = $HTTP_POST_VARS['specialreq']; 


// MODIFY THE FOLLOWING SECTION 

// your name 
$recipientname = "Company X"; 

// your email 
$recipientemail = "[email protected]"; 

// subject of the email sent to you 
$subject = "Quote Request for $recipientname"; 

// send an autoresponse to the user? 
$autoresponse = "yes"; 

// subject of autoresponse 
$autosubject = "Thank you for your mail!"; 

// autoresponse message 
$automessage = "Thanks for the message. We've successfully received your quote request and will get back to you shortly."; 

// thankyou displayed after the user clicks "submit" 
$thanks = "Thank you for contacting us. We will get back to you as soon as possible."; 

// END OF NECESSARY MODIFICATIONS 

// format message 
$message = "Online-Form Response for $recipientname: 
<br> 
Contact Name: $Contactname 
<br> 
Business: $Business 
<br> 
Email: $email 
<br> 
Address: $Address 
<br> 
City: $City 
<br> 
State: $State 
<br> 
Zip: $Zip 
<br> 
Phone: $Phone 
<br> 
Fax: $Fax 
<br> 
<br> 
<br> 
Describe your product(s): $product_desc 
<br> 
How will your product be delivered?: $delivery 
<br> 
How many SKU's (items): $sku 
<br> 
How many turns per year?: $annualturns 
<br> 
Are your products seasonal?: $seasonal 
<br> 
Indicate minimum and Maximum pallet levels: $minmaxpallet 
<br> 
Average value per pallet: $avgpalletval 
<br> 
Weight of a typical pallet: $avgpalletwt 
<br> 
Maximum pallet stacking height: $maxpalletht 
<br> 
Cases per pallet? Or average case size?: $casesperpallet 
<br> 
Weight of each unit?: $unitweight 
<br> 
Do you require lot number control?: $reqlotnumctrl 
<br> 
What freight class?: $freightclass 
<br> 
Is the product hazardous? If so, what classifications?: $hazardclass 
<br> 
<br> 
<br> 
Do you need custom Barcodes made?: $barcodes 
<br> 
What is the average number of orders shipped via UPS/Fedex?: $avgupsfedex 
<br> 
What is the average order size in weight?: $avgorderweight 
<br> 
What is the average number of lines per order?: $avgorderlines 
<br> 
Will your orders be sent via E-mail, FAX, or other?: $ordersending 
<br> 
Will you have customer pick ups, and how often?: $custpickups 
<br> 
Can your company e-mail us flat files?: $flatfiles 
<br> 
Do your orders need to be shrink wrapped?: $shrinkwrap 
<br> 
Do you need repackaging?: $repack 
<br> 
Are there any special requirements that your company may have?: $specialreq 
<br>"; 

// 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 .= 'From: Company X <[email protected]>' . "\r\n"; 


// send mail and print success message 
mail($recipientemail, $subject, $message, $headers); 

if($autoresponse == "yes") { 
$autosubject = stripslashes($autosubject); 
$automessage = stripslashes($automessage); 
mail($email,"$autosubject","$automessage","From: $recipientname <$recipientemail>"); 
} 

    echo "<script language=\"JavaScript\" type=\"text/JavaScript\"> window.location.href = \"thanks_quote.php\";</script>"; 

?> 

편집 :

이 내 처리 파일입니다 내가 (전역에와) 다른 서버에서 테스트하고, 양식이 잘 작동,하지만 난 그래서 내 스크립트를 다시 작성하는 방법을 잘 모르겠어요 그것을 POST에 의존하지 않습니까?

+0

시도와 함께'$ HTTP_POST_VARS' 교체는'$ _POST' – Virendra

+0

는 와우는 약간 무거운 코드입니다. '$ _POST'를 사용하십시오. 또한'language = \ "JavaScript \"'를 제거하거나'header ("Location : thanks_quote.php")'를 사용할 수 있습니다. –

답변

1

HTTP_POST_VARS은 더 이상 사용되지 않습니다. 또한 register_globals는 5.3.0 이상에서 사용되지 않습니다. 따라서 HTTP_POST_VARS 대신 $_POST을 사용하십시오. 또한, 대신 마지막 줄의

:

echo "<script language=\"JavaScript\" type=\"text/JavaScript\"> window.location.href = \"thanks_quote.php\";</script>"; 

다른 페이지로 리디렉션, 사용 :

header('Location: thanks_quote.php');