2011-07-29 112 views
0

與回調請求表單存在一些問題我正在嘗試爲移動網站構建。基本上問題是我收到電子郵件,但是這些字段是空的,就好像它沒有輸入任何輸入字段一樣。顯然,必須與PHP抓住我的領域,並張貼出了問題,但我似乎無法找出我做錯了什麼:發佈PHP聯繫表單

<?php 

$EmailFrom = $_POST['ftEmail']; 
// $EmailTo = "[email protected]"; 
$EmailTo = "[email protected]"; 
$Subject = "Call back request from a mobile"; 
$Name = Trim(stripslashes($_POST['ftName'])); 
$Email = Trim(stripslashes($_POST['ftEmail'])); 
$Tel = Trim(stripslashes($_POST['ftTel'])); 
/* - IF NEED TO CONNECT TO DATABASE 
$con = mysql_connect("xxx","xxx","xxx"); 
if (!$con) 
    { 
    die('Could not connect: ' . mysql_error()); 
    } 

mysql_select_db("farmpro1_mosuro", $con); 

$sql="INSERT INTO contact_form (Name, Tel, Email) 
VALUES 
('$_POST[Name]','$_POST[Tel]','$_POST[Email]')"; 

if (!mysql_query($sql,$con)) 
    { 
    die('Error: ' . mysql_error()); 
    } 

*/ 

// email body text 
$Body = ""; 
$Body .= "Name: "; 
$Body .= $Name; 
$Body .= "\n"; 
$Body .= "Email: "; 
$Body .= $Email; 
$Body .= "\n"; 
$Body .= "Tel: "; 
$Body .= $Tel; 
$Body .= "\n"; 




    // send the email 
    $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); 

    // redirect to thank you page 
    if ($success){ 
     print "<meta http-equiv=\"refresh\" content=\"0;URL=contact_thanks.php\">"; 
    } 
    else{ 
     print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">"; 
    } 



mysql_close($con) 

?> 






<form action="send_request_mobile.php"> 
         <input type="text" value="ftName" name="ftName" id="ftName"><br> 
         <input type="text" value="ftEmail" name="ftEmail" id="ftEmail"><br> 
         <input type="text" value="ftTel" name="ftTel" id="ftTel"> 
         <input type="submit" value="SEND" class="ftSubmit"> 
</form> 

任何幫助,這將是偉大的!

感謝,

+0

待辦事項重定向使用'Location' HTTP頭,而不是''阿 – Quentin

回答

4

你的表單沒有method屬性,因此它默認爲GET,你在$_POST尋找數據。

<form action="send_request_mobile.php" method="post"> 
+0

,打我給它。 '

' –

+0

crap im too slow .... method =「post」was missing :( – Drewdin