0
私のフォームにはこのコードを使用していますが、この場合は「type」という1つの変数しか送信しません。私の間違いのようですか?1つの変数を送信するだけの電子メールのためのPHPフォーム
PHP
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$type = $_POST['type'];
$message = $_POST['message'];
$formcontent=" From: $name \n subject: $subject \n email: $email \n Type: $type \n Message: $message";
$recipient = "[email protected]";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "We will call you as soon as possible!" . " -" . "<a href='contact.html' style='text-decoration:none;color:#ff0099;'> Return Home</a>";
?>
これは、対応するHTML5のコードである
<form action="mail.php" method="post" role="form" class="contactForm">
<div class="s-12 l-7"><input type="text" name="name" class="form-control" id="name" placeholder="Your Name" data-rule="minlen:4" data-msg="Please enter at least 4 chars" /></div>
<div class="validation"></div>
<div class="s-12 l-7"><input type="email" class="form-control" name="email" id="email" placeholder="Your Email" data-rule="email" data-msg="Please enter a valid email" /></div>
<div class="validation"></div>
<div class="s-12"><input type="text" class="form-control" name="subject" id="subject" placeholder="Subject" data-rule="minlen:4" data-msg="Please enter at cell number plus code" /></div>
<div class="validation"></div>
<div class="s-12 l-7"><p placeholder="Subject" data-rule="minlen:4">type
<select name="type" size="1">
<option value="update">Website Update</option>
<option value="change">Information Change</option>
<option value="addition">Information Addition</option>
<option value="new">New Products</option>
</select></p></div>
<div class="validation"></div>
<div class="s-12 l-7"><textarea class="form-control" name="message" id="message" rows="5" data-rule="required" data-msg="Please write something for us" placeholder="Message"></textarea><br/></div>
<div class="validation"></div>
<div class="s-12 m-6 l-4"><button type="submit" name="submit" value="submit" class="btn btn-primary btn-lg" required="required">Submit Message</button></div>
</form>