为什么我的表单提交按钮停止工作? [关闭]

为什么我的表单提交按钮停止工作? 它只是停了一夜-昨天我测试了几次,它仍然有效。 我认为我没有碰过它使用的任何代码。

The button is in a logo order form on my website https://rebranding.company/. After you click the "Get Your Logo!" button, another div appears and the "Let's Start Now!" button is the one that is not working. It used to submit the form using a contact.php file. Now it doesn't do anything (even thought it is clickable).

表格开头为:

    <form class="contact-form animated fadeIn wow brandform" method="post" action="php/contact.php">

按钮基本上是这样的:

    <button class="bttn btn-lg" id="btnClick" type="submit" VALUE="1" name="pressed">Let's Start Now!</button>

与contact.php是:

<?php
/*
 *  CONFIGURE EVERYTHING HERE
 */

// an email address that will be in the From field of the email.
$from = 'hello@rebranding.company';

// an email address that will receive the email with the output of the form
$sendTo = 'hello@rebranding.company';

// subject of the email
$subject = 'New Logo, Branding';

// form field names and their translations.
// array variable name => Text to appear in the email
$fields = array('BrandName' => 'Brand Name', 'BrandIndustry' => 'Brand Industry', 'Activity' => 'What does the Brand do?','Character' => 'Brand character', 'Preferences' => 'Preferred imagery, colors', 'TargetGroup' => 'Target Group', 'Competition' => 'Competition comparison',  'Info' => 'Additional information', 'Budget' => 'Budget', 'DeclaredBudget' => 'Declared Budget', 'Deadline' => 'Finishing date', 'Name' => 'Name', 'Email' => 'Email', 'Service' => 'Ordered Service'); 

// message that will be displayed when everything is OK :)
$okMessage = 'Contact form successfully submitted. Thank you, I will get back to you soon!';

// If something goes wrong, we will display this message.
$errorMessage = 'There was an error while submitting the form. Please try again later';

/*
 *  LET'S DO THE SENDING
 */

// if you are not debugging and don't need error reporting, turn this off by error_reporting(0);
error_reporting(E_ALL & ~E_NOTICE);

try
{

    if(count($_POST) == 0) throw new \Exception('Form is empty');

    $emailText = "You have a new message from your contact form\n=============================\n";

    foreach ($_POST as $key => $value) {
        // If the field exists in the $fields array, include it in the email 
        if (isset($fields[$key])) {
            $emailText .= "$fields[$key]: $value\n";
        }
    }

    // All the neccessary headers for the email.
    $headers = array('Content-Type: text/plain; charset="UTF-8";',
        'From: ' . $from,
        'Reply-To: ' . $from,
        'Return-Path: ' . $from,
    );

    // Send email
    mail($sendTo, $subject, $emailText, implode("\n", $headers));

    $responseArray = array('type' => 'success', 'message' => $okMessage);
}
catch (\Exception $e)
{
    $responseArray = array('type' => 'danger', 'message' => $errorMessage);
}



if($_POST['pressed'] == 1 )
    header("Location: https://rebranding.company/sending-success.html");



// if requested by AJAX request return JSON response
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
    $encoded = json_encode($responseArray);

    header('Content-Type: application/json');

    echo $encoded;
}
// else just display the message
else {
    echo $responseArray['message'];
}

有人知道哪里出了问题吗?如我所说,它似乎突然停止工作而没有理由。我不知道我在想什么。

评论