0

「SEND」をクリックすると、ありがとうと言ってホームページにリダイレクトされるように、PHP コンタクトフォームを設定しようとしています。これは私のphpとhtml用のスクリプトです。ほんの数行を調整する必要があることは知っていますが、正確な方法はわかりません。mail.php ファイルを Web サイトのディレクトリにアップロードしました。

  <?php
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$call = $_POST['call'];
$website = $_POST['website'];
$priority = $_POST['priority'];
$type = $_POST['type'];
$message = $_POST['message'];
$formcontent=" From: $name \n Phone: $phone \n Call Back: $call \n Website: $website \n Priority: $priority \n Type: $type \n Message: $message";
$recipient = "horgantm@gmail.com";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
if(mail($recipient, $subject, $formcontent, $mailheader))

    { 
        header("Location: http://www.darthvixcustomsabers.com/index.html");
        exit;   
    }
    else
    {
        die("Error!");
    }
echo "Thank You!" . " -" . "<a href='index.html' style='text-decoration:none;color:#ff0099;'> Return Home</a>";

?>


<!doctype html>
<html>
<head>
<title> DV Custom Sabers </title>
<meta charset="utf-8">
<link type="text/css" rel="stylesheet" href="style/kotorsale.css" />
<meta name="viewport" content="width=device-width" />


</head>
<div class="header"><a href="index.html">Darthvix Custom Sabers</a></div>

<div class="header1">DV Custom Sabers is the place to go for your saber needs!</div>

<div class="logo"><a href="index.html"><img src="images/logo.png" alt="schedule" height="200" width="350" border="0"></a></div>

<ul id="nav">
    <li><a href="index.html">Home</a></li>
    <li><a href="aboutme.html">About Me</a></li>
    <li><a href="services.html">Services</a></li>
    <li><a href="Gallery.html">Gallery</a></li>
    <li><a href="kotorsale.html">For Sale</a></li>
    <li><a href="buildlog.html">Build Log</a></li>
    <li><a href="contact.html"> Contact Us</a></li>
</ul>
<div id="form">
<<form action="mail.php" method="POST">

<p>Name</p> <input type="text" name="name">

<p>Email</p> <input type="text" name="email">


<p>Priority</p>

<select name="priority" size="1">

<option value="Low">Low</option>

<option value="Normal">Normal</option>

<option value="High">High</option>

<option value="Emergency">Emergency</option>

</select>

<br />

<p>Message</p><textarea name="message" rows="6" cols="25"></textarea><br />

<input type="submit" value="Send"><input type="reset" value="Clear">

</form>

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

2 に答える 2