PHP Contact Form Not Submitted

I have a contact form on a page that sends form details to an email address. You can watch it here, www.wonder.ie

HTML for the form:

<form id="form" name="form27" class="wufoo  page" enctype="multipart/form-data" method="post" action="mailer.php">  
    <ul>
        <li id="foli1">
            <label class="op" id="title1" for="Field1">Name</label>
            <div><input id="Field1" name="name" type="text" class="op required" value="" maxlength="255" tabindex="1" onkeyup="handleInput(this);" onchange="handleInput(this);" /></div>  
        </li>

        <li id="foli2">
        <label class="op" id="title2" for="Field2">Email</label>
            <div><input id="Field2" name="email" type="text" class="op required email" value="" maxlength="255" tabindex="2" onkeyup="handleInput(this);" onchange="handleInput(this);" /></div>
        </li>

        <li id="foli3">
            <label class="op" id="title3" for="Field3">Inquiry</label>
            <div><textarea id="Field3" name="message" class="op required" rows="10" cols="50" tabindex="3" onkeyup="handleInput(this);" onchange="handleInput(this);"></textarea></div>
        </li>
        </ul>  
        <input id="button" name="saveForm" class="btTxt submit" type="submit" value="Submit" />         
</form>

And for my PHP this is:

<?php
if(isset($_POST['submit'])) {
$to = "AN_EMAIL@ADDRESS.COM";
$subject = "Email from Wonder.ie";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];

$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message";

mail($to, $subject, $body);
} else {
echo "blarg!";
}
?>

Does everything look right? I know that the form names are correctly mapped to PHP, but I can’t understand why I don’t get the email address that you know - FYI PHP on the site has a real email address, not AN_EMAIL@ADDRESS.COM. As soon as I hit the submit button, I hit mailer.php but noticed that the echo was "blarg!" therefore, I assume that the letter is not sent.

Thank!

+3
source share
9

if(isset($_POST['submit'])) {

if(isset($_POST['saveForm'])) {
+10

if(isset($_POST['submit'])) {

to

if(isset($_POST['saveForm'])) {

, $_POST , .

+2
+2

PHP- , $_POST['submit'], HTML- submit saveForm,

if(isset($_POST['submit'])) {

if(isset($_POST['saveForm'])) {

, :)

0

html

<input id="button" name="saveForm" class="btTxt submit" type="submit" value="Submit" />

php, $_POST["submit"], .

if(isset($_POST['submit'])) if(isset($_POST['saveForm']))

if(isset($_POST['submit'])) if(isset($_POST))

0

, . , .

http://us2.php.net/manual/en/function.mail.php

$header = "From: ".$fromText."\r\n";
$header .= "Cc: ".$ccText."\n";
$header .= "Reply-To : ".$fromText."\r\n";
$header .= "Return-Path : ".$fromText."\r\n";
$header .= "X-Mailer: PHP\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: text/plain; charset=iso-8859-1\r\n";
mail($toText, $subjectText, $msgText, $header, '-f'.$fromText);
0

, .

mail($to, $subject, $body);

submit

'SaveForm'

:)..

mail($to, $subject, $body);

x.php, , , .

 if(@mail($emailRecipient, $subject, $message, $headers))
    {
      echo "Mail Sent Successfully";
    }else{
      echo "Mail Not Sent";
    }

, stackoverflow , .

0



 if(isset($_POST['submit'])) {

saveForm
,

if(isset($_POST['saveForm'])) {

0

Source: https://habr.com/ru/post/1733592/


All Articles