0

これを正しく機能させることはできません。私はそれがばかげていることを知っていますが、それを見つけることができません。

<?php

$mailto   = "stormygurl73@yahoo.com";  
$name     = ucwords($_POST['name']); 
$subject  = $_POST['Contact form'];
$email    = $_POST['email'];
$message  = $_POST['message'];

    if(strlen($_POST['name']) < 1 ){
        echo  'email_error';
    }

  else if(strlen($email) < 1 ) {
        echo 'email_error';
    }

  else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", $email)) {
    echo 'email_error';
  }

    else if(strlen($message) < 1 ){
        echo 'email_error';

  } else {

    // NOW SEND THE ENQUIRY

    $email_message="\n\n" .
        "Name : " .
        ucwords($name) .
        "\n" .
        "Email : " .
        $email .
        "\n\n" .
        "Message : " .
        "\n" .
        $message .
        "\n" .
        "\n\n" ;

        $email_message = trim(stripslashes($email_message));
        mail($mailto, $subject, $email_message, "From: \"$vname\" <".$email.">\nReply-To: \"".ucwords($name)."\" <".$email.">\nX-Mailer: PHP/" . phpversion() );

}
?>

HTML

<div class="wrapper">
    <div id="main" style="padding:50px 0 0 0;">
    <form id="contact-form" action="sendemail.php" method="post">
      <h3>Get in touch</h3>
      <h4>Fill in the form below, and we'll get back to you within 24 hours.</h4>
      <div>
        <label>
          <span>Name: (required)</span>
          <input placeholder="Please enter your name" type="text" tabindex="1" required autofocus>
        </label>
      </div>
      <div>
        <label>
          <span>Email: (required)</span>
          <input placeholder="Please enter your email address" type="email" tabindex="2" required>
        </label>
      </div>

      <div>
        <label>
          <span>Message: (required)</span>
          <textarea placeholder="Include all the details you can" tabindex="5" required></textarea>
        </label>
      </div>
      <div>
        <button name="submit" type="submit" id="contact-submit">Send Email</button>
      </div>
    </form>
    <!-- /Form -->

どんな助けでも素晴らしいでしょう!

4

2 に答える 2