0

私はphpを書くのはかなり初めてで、情報をメールに送信する登録フォームがありますが、情報が届かないため、mail.phpに何かが欠けていると思います。

これは私のhtml5フォームです:

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Register</title>
<link href="css/reset.css" rel="stylesheet" type="text/css">
<link href="css/register.css" rel="stylesheet" type="text/css">

</head>


<div id="container">
<section id="register">

                 <form action="mail.php" method="post" accept-charset="utf-8">
                    <h4>Your Jeep</h4>
                <div class="form-field">
                    <fieldset>
                        <label>Year</label>
                        <input value="" placeholder="Year" type="text"      name="year">
                    </fieldset>
                </div>

                 <div class="form-field">
                    <fieldset>
                        <label>Color</label>
                        <input value="" placeholder="Color" type="text" name="color">
                    </fieldset>
                </div>

                 <div class="form-field">
                    <fieldset>
                        <label>Class</label>
                        <input value="" placeholder="Stock, Modified, Highly Modified"   type="text" name="class">
                    </fieldset>
                </div>

               <!--------------------
                <div class="form-field">
                    <fieldset>
                        <label>Class</label>
                        <select class="form-field">
                        <option value="Select Class">Select Class</option>
                        <option value="Stock">Stock</option>
                        <option value="Modified">Modified</option>
                        <option value="Highly Modified">Highly Modified</option>
                        </select>
                    </fieldset>
                </div>
                 ------------------------->

                <div class="form-field">
                    <fieldset>
                        <label>Last 4 digets of VIN</label>
                        <input value="" placeholder="Last 4 digets of VIN" type="text" name="vin">
                    </fieldset>
                </div>




             </form>  


             <form>
                        <h4>You</h4>
                    <div class="form-field">
                        <fieldset>
                            <label>Name</label>
                            <input value="" placeholder="Name" type="text" name="name">
                        </fieldset>
                    </div>

                    <div class="form-field">
                        <fieldset>
                            <label>Address</label>
                            <input value="" placeholder="Address" type="text" name="address">
                        </fieldset>
                    </div>

                    <div class="form-field">
                        <fieldset>
                            <label>City</label>
                            <input value="" placeholder="City" type="text" name="city">
                        </fieldset>
                    </div>

                    <div class="form-field">
                        <fieldset>
                            <label>State</label>
                            <input value="" placeholder="State" type="text" name="state">
                        </fieldset>
                    </div>

                    <div class="form-field">
                        <fieldset>
                            <label>Zip</label>
                            <input value="" placeholder="Zip" type="text" name="Zip">
                        </fieldset>
                    </div>

                    <div class="form-field">
                        <fieldset>
                            <label>Email</label>
                            <input value="" placeholder="Email" type="text" name="email">
                        </fieldset>
                    </div>
                </form>

                  <form>

                       <div class="form-button">
                            <input type="submit" value="Send"><input type="reset" value="Clear">

                        </div> 



                   </form>




             </section>
  </div>           

<body>
</body>
</html>

これは私のmail.phpです:

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Form</title>
</head>


<?php
$year= $_POST['year'];

$color= $_POST['color'];

$class= $_POST['class'];

$vin= $_POST['vin'];

$name= $_POST['name'];

$address= $_POST['address'];

$city= $_POST['city'];

$state= $_POST['state'];

$zip= $_POST['zip'];

$email= $_POST['email'];

$formcontent="From: $name \n From: $city";

$recipient = "mjadecole17@yahoo.com";

$subject = "JatB Registration";

$mailheader = "From: $email \r\n";

mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");

echo "Thank You!" . " -" . "<a href='index.html' style='text-decoration:none;color:#f15c25;'>        Return Home</a>";

?>



<body>
</body>
</html>
4

3 に答える 3

0

あなたの送信ボタンの形が違います!

空のフォームを送信しています。

合計 3 つのフォームがあります。それらの実装から判断すると、mail.phpそれらはすべて同じ形式である必要があります。

于 2013-07-25T15:41:34.203 に答える
0

まず、送信ボタンが別のフォームになっています。

次に、コメント タグが正しく終了していません (ただし、ブラウザが自動的に処理します)。

3 番目に、mail() 関数はすべてをメールサーバーに送信しています。したがって、PHP でメールを送信するには、メールサーバーにアクセスする必要があります。

于 2013-07-25T16:14:52.183 に答える