2017-03-01 1 views
-1

私は正しく機能するフォームを作成しましたが、ユーザーが登録して肥大を使用しようとすると、データベースに反映されず、エラーの句も表示されません。PHPフォームの肥大のエラー

購入者の完全な名前:Tina's Place。

コード

<form method='post' action='' enctype='multipart/form-data' id='payment_section'> 
    <input type='text' name='buyer_name' placeholder='Buyer Full Name' style='width:100%;' required><br> 
    <input type='text' name='email' placeholder='Email Address' style='width:100%;' required><br> 
    <input type='text' name='phone_num' placeholder='Phone Number' style='width:100%;font-family:sans-serif;' required><br> 
    <input type='text' name='couple_name' placeholder='Full Name of either Bride or Groom' style='width:100%; color:#646464;' required> 
    <textarea name='good_will' placeholder='Goodwill Message (Optional)' class='form-control' style='margin-bottom:20px; width:100%;' rows='3'></textarea> 
    <button id='sub_btn' type='submit' name='order' style='margin-top:10px;'>Order</button> 
</form> 

PHPコード

<?php 

if(isset($_POST['order'])){ 

    $buyer_name = $_POST['buyer_name']; 
    $email = $_POST['email']; 
    $phone_num = $_POST['phone_num']; 
    $couple_name = $_POST['couple_name']; 
    $good_will = $_POST['good_will']; 

    $order_gift = "INSERT INTO payment_order(buyer_name,email,phone_num,couple_name,good_will,address,pro_title,pro_price,vendor) VALUES ('".$buyer_name."','".$email."','".$phone_num."','".$couple_name."','".$good_will."','Payment Online','".$pro_title."','".$pro_price."','".$pro_vendor."')"; 

    $run_me = mysql_query("$order_gift"); 
    //$to= ''.$email.''; 
    $to = '[email protected]'; 
    $subject = 'Product Order'; 

    // message 
    $message = ' 
    Gift Registry order: "'.$pro_title.'", Gift for: "'.$couple_name.'", Name: "'.$buyer_name.'", Address: Deliver to couple, Email- "'.$email.'", Phone Number- "'.$phone_num.'". 
    '; 

     if (mail($to, $subject, $message)){ 
      echo "<script>alert('You have successfully ordered for this gift item.')</script>"; 
      echo "<script>window.close('index.php','_self')</script>"; 
     } 
     else{ 
      echo "<script>alert('Error')</script>"; 
      } 
    } 
?> 
+0

通知@u_mulderのおかげで、修正されました –

答えて

0

まず、あなたのHTMLが間違っています。 ID「contact_input」を複数回使用します。 IDは、各HTML文書に固有です。スタイルを適用する必要がある場合や、複数の要素を指定する必要がある場合は、class = "contact_input"を使用する必要があります。

あなたの問題をよりよく説明できますか?わかりません;

ユーザーは、それがデータベースに反映してい ん。また、エラーの句にない他人の作品のテキスト

たぶん、いくつかの例を表示しない肥大を登録し、ユーザーしようとする任意の時間作業。

関連する問題