两个PHP邮件表单问题


Two PHP Mail form issues

我对这个PHP Form Mailer有问题。。。

我在这里有网站。

这是表单的HTML…

            <form method="post" id="submitform" action="submitemail.php" >
                        <input type="text" style="height: 40px;" class="formstyle" title="Your Name" placeholder="First & Last Name" name="name" />
                        <input type="tel" style="height: 40px;" class="formstyle" title="Phone Number" placeholder="###-###-####" name="phone" />       
                        <input type="email" style="height: 40px;" class="formstyle" title="Email" placeholder="Email Address" name="email" />
                        <input type="email" style="height: 40px;" class="formstyle" title="Confirm Email" placeholder="Confirm Email" name="email_confirm" />
                        <input type="text" style="height: 40px;" class="formstyle" title="Ticket Price Low" placeholder="$ Amount" name="low_price" />
                        <input type="text" style="height: 40px;" class="formstyle" title="Ticket Price High" placeholder="$ Amount" name="high_price" />
                        <input type="text" style="height: 40px;" class="formstyle" title="Venue Name" placeholder="Where will it be?" name="venue_name" />
                        <input type="text" style="height: 40px;" class="formstyle" title="Event Capacity" placeholder="# of people attending" name="event_capacity" />
                        <textarea name="message" style="height: 90px;" title="Event Description" placeholder="Please describe anything about this event we should know."></textarea>
                        <input class="formstyletwo" type="submit" value="Send">  
            </form>

这是PHP

    $emailerror .= "Your booking form has been submitted. You will hear from us shortly.";
    // NOW SEND THE ENQUIRY
    $timestamp = date("F j, Y, g:ia");
    $messageproper ="'n'n" .
        "Name: " .
        ucwords($_POST['name']) .
        "'n" .
        "Phone: " .
        ucwords('phone') .
        "'n" .
        "Email: " .
        $_POST['email'] .
        "'n" .
        "Confirmed Email: " .
        $_POST['email_confirm'] .
        "'n" .
        "Low Budget: " .
        $_POST['low_price'] .
        "'n" .
        "Hight Budget: " .
        $_POST['high_price'] .
        "'n" .
        "Venue Name: " .
        $_POST['venue_name'] .
        "'n" .
        "Event Capacity: " .
        $_POST['event_capacity'] .
        "'n" .
        "Event Description: " .
        $_POST['message'] .
        "'n" .
        "'n'n" ;
        $messageproper = trim(stripslashes($messageproper));
        mail($mailto, $subject, $messageproper, "From: '"$vname'" <".$_POST['e_mail'].">'nReply-To: '"".ucwords($_POST['first_name'])."'" <".$_POST['e_mail'].">'nX-Mailer: PHP/" . phpversion() );
}
?>
<div id='emailerror'>
    <ul>
        <? echo $emailerror; ?>
    </ul>

这个表格还可以。

  1. 我正在尝试显示一条消息,上面写着:"您的预订表格已提交。您很快就会收到我们的来信",但是它不起作用。

  2. 另一个问题是,我想让每个字段都成为必填字段。我找到了使电子邮件字段成为必填项的信息,但没有其他。

你能帮忙吗?

<?php
if(isset($_POST["submit_button_name"])){
mail($mailto, $subject, $messageproper, "From: '"$vname'" <".$_POST['e_mail'].">'nReply-To: '"".ucwords($_POST['first_name'])."'" <".$_POST['e_mail'].">'nX-Mailer: PHP/" . phpversion() );
echo "Your booking form has been submitted. You will hear from us shortly.";
}
else{
echo "An error occured.";
}
?>

要使表单成为必需的,只需在输入中放置必需的即可。

<input type="text" name="myfield" placeholder="Example" required>

不客气。