我遇到了我的PHP問題,我希望你能幫助我。PHP:一種形式,一種提交,PHP中有幾個「動作」
實質上,客戶端需要一個表單和一個提交按鈕,但是他希望PHP將信息發送到兩個地方:1.)將「評論」消息直接發送到他的電子郵件收件箱,但也2.)將電子郵件地址和隱藏變量發送給Constant Contact(這是執行他的通訊的公司)。
這裏是通過HTML表單:
<form action="SendToConstantContact.php" name="myform" method="post">
Your email*:<br/>
<input type="text" name="ea" size="39" value="" style="font-size:10pt;"><br/>
Your message (optional):<br/>
<textarea name="comments" cols="30" rows="3" style="font-size:10pt;"></textarea><br/>
<input type="hidden" name="llr" value="z4u4kndab">
<input type="hidden" name="m" value="1103180583929">
<input type="hidden" name="p" value="oi">
<input type="submit" value="Submit" />
</form>
這裏是PHP爲止。我有第一個目標 - 工作到這個PHP,PHP直接發送一封電子郵件到郵件內容的收件箱。我可以在這個PHP代碼中添加什麼以將變量一起發送到常量聯繫人?
<?php
$emailSubject = 'Customer Has a Question!';
$webMaster = '[email protected]';
$ea = $_POST['ea'];
$comments = $_POST ['comments'];
$llr = $_POST ['llr'];
$m = $_POST ['m'];
$p = $_POST ['p'];
$body = <<<EOD
<br><hr><br>
Email: $ea <br>
Comments: $comments <br>
<br>
And below are the four variables sent to Constant Contact:<br>
Email: $ea <br>
LLR: $llr <br>
M: $m <br>
P: $p <br>
<br>
These comments were sent from the test.html page of the JW Secure site. <br>
The visitor has checked the box that would send their information to Constant Contact.<br>
EOD;
$headers = "From: $ea\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);
$theResults = <<<EOD
<META http-equiv="refresh" content="0;URL=http://www.jwsecure.com/contact/thank-you/">
EOD;
echo "$theResults";
?>
我環顧四周,在這個網站和其他人,但我還沒有發現的只是沿着你的PHP文件發送信息的例子。看起來它會比較簡單,但我很難過。我所嘗試的一切都會導致錯誤。如果它是一個直接發佈到ConstantContact的HTML表單,那麼這個動作應該是:「action =」http://visitor.r20.constantcontact.com/d.jsp「......但我不是一個PHP人(顯然) ,這樣有利於與語法非常感謝!
謝謝你在前進, 巴里
你可以使用捲曲。 – DaGardner
你可以使用ajax。 – DevZer0
嘗試谷歌搜索「cURL POST PHP」(我不是故意粗魯,但我沒有時間完整的答案) –