2017-01-17 6 views
0

보낸 사람의 의견을 내 이메일 주소로 보내려고합니다. 다음 코드를 작성합니다. 그러나 내가 제출을 누르면 아무 일도 일어나지 않습니다.PHP 양식을 사용하여 의견 보내기

<?php 
$action=$_REQUEST['action']; 
if ($action=="") { 
/* display the contact form */ 
?> 
    <form method="post" action="" enctype="multipart/form-data"> 
     <input class="inputst" type="text" placeholder="Your Name" name="s_name"><br> 
     <input class="inputst" type="email" placeholder="Your Email" name="s_email"><br> 
     <input class="inputst" type="text" placeholder="Phone Number" name="s_mobile"><br> 
     <input class="inputst" type="text" placeholder="Delivery Address" name="s_address"><br> 
     <input class="inputst" name="s_link" type="text" value="http://alutamarket.com/boutique-and-fashion-store/phones-tabs-accessories/samsung-galaxy-note-3_i3" name="productlink"><br> 
     <div style="margin-top:20px;"><a type="submit" class="im-contac"><span class="im-top">Send Now</span><span class="im-bot">Send inquiry now</span><i class="fa fa-paper-plane"></i></a></div> 
    </form> 
<?php 
} else { 
    /* send the submitted data */ 
    $name=$_REQUEST['s_name']; 
    $email=$_REQUEST['s_email']; 
    $mobile=$_REQUEST['s_mobile']; 
    $address=$_REQUEST['s_address']; 
    $message=$_REQUEST['s_link']; 
    if (($name=="")||($email=="")||($mobile=="")||($address=="")||($message=="")) { 
     echo "All fields are required, please fill <a href=\"\">the form</a> again."; 
    } else {   
     $from="From: $name<$email>\r\nReturn-path: $email"; 
     $subject="Message sent using your contact form"; 
     mail("[email protected]", $subject, $message, $from); 
     echo "Email sent!"; 
    } 
} 
?> 

송부인에게도 하나의 이메일을 보내고 싶습니다.

답변

1

변경 필요

1)은이

<?php 
if(isset($_POST['submit'])) { 
    $name=$_POST['s_name']; 
    $email=$_POST['s_email']; 
    $mobile=$_POST['s_mobile']; 
    $address=$_POST['s_address']; 
    $message=$_POST['s_link']; 
    if (($name=="")||($email=="")||($mobile=="")||($address=="")||($message=="")) { 
     echo "All fields are required, please fill <a href=\"\">the form</a> again."; 
    } else {  
     $from="From: $name<$email>\r\nReturn-path: $email"; 
     $subject="Message sent using your contact form"; 
     mail("[email protected]", $subject, $message, $from); 
     echo "Email sent!"; 
    } 
} 
?> 

<?php 
$action=$_REQUEST['action']; 
if ($action=="") { 
    /* display the contact form */ 
    ?> 
    <form method="post" action="" enctype="multipart/form-data"> 
     <input class="inputst" type="text" placeholder="Your Name" name="s_name"><br> 
     <input class="inputst" type="email" placeholder="Your Email" name="s_email"><br> 
     <input class="inputst" type="text" placeholder="Phone Number" name="s_mobile"><br> 
     <input class="inputst" type="text" placeholder="Delivery Address" name="s_address"><br> 
     <input class="inputst" name="s_link" type="text" value="http://alutamarket.com/boutique-and-fashion-store/phones-tabs-accessories/samsung-galaxy-note-3_i3" name="productlink"><br> 
     <div style="margin-top:20px;"><button type="submit" name="submit" class="im-contac"><span class="im-top">Send Now</span><span class="im-bot">Send inquiry now</span><i class="fa fa-paper-plane"></i></button></div> 
    </form> 
<?php 
} 
?> 
을 시도 형태를

2) 체크 버튼을 클릭 제출는 isset 여부

제출 제출 만들

관련 문제