1
私はユーザーの名前、電子メール、質問を集めるフォームを作成しようとしていましたが、私はPHPでこれまで本当に苦労していました。HTML形式のPHP電子メールの検証と取得
目的は情報を収集することです。送信者が送信を押すと、自分のメールアドレスが自分のメールアドレスに送信されるはずです。本当のメールアドレスであることを確認したいと思います。
HTMLコード:
<form method="post" action="process.php">
<fieldset>
<legend>Personal Information</legend>
<p><label for="name">Name:</label>
<input type="text" name="name" id="name" maxlength="50" autofocus required /></p>
<p><label for="recipient">Email Address:</label>
<input id="recipient" name="recipient" type="text" name="recipient" required></p>
</fieldset>
<fieldset>
<legend>Tours Interested In:</legend>
<p><label for="question">Questions/Comments:</label>
<textarea id="question" name="question" cols="50" rows="3" placeholder="type your comments here" required></textarea>
</fieldset>
<p class="centralize"><input type="submit" onclick="send()" value="Submit Only" /></p>
<p class="centralize"><input type="reset" value="Clear Form"></p>
<p id="data_return"></p>
</form>
PHPのCODE:メール()関数は、PHP hereでどのように機能するか
<?php
header("Content-type: text/html");
$name=$_POST["name"];
$question=$_POST["question"];
$email =$_POST["email"];
$subject = "You have a USER INQUIRY:";
$to = '[email protected]';
if(!$_POST['name']){
$errName = 'Please enter your name';
}
echo "<p>Thank you, $name . Your Email has been Sent, and we will get back to you within 48 hours.</p>";
//Build email (to myself)
mail($to, $name, $subject, $question, $email);
マニュアルでメール機能が受け付ける引数を見てください –