0

I fixed most of the problems based on the answers, but there seems to be more errors i'm not knowledgeable enough to find, i added a name to the submit button, i ran it with developer tools monitoring and it says the error is with the opening php tag and an apparently unbalanced

tag, any help would be appreciated
<!DOCTYPE html>
<html>
    <head>
        <title>Submit a Report</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
        <h2>Send a report to our administrators</h2>
        <form method="POST" action="ReportForm.php">
            Offending Player's username:<br>
            <input type="text" name="theirName"><br><br>
            What did they do?:<br>
            <input type="text" name="message" size="10"><br><br>
            Your Minecraft Username:<br>
            <input type="text" id="yourName" name="yourName"><br><br>
            <input type="submit" name="Send" value="Send">
            <input type="reset" value="Reset">
        </form>
    </body>
</html>

<?php
$name = $_POST['yourName'];
$playerName = $_POST['theirName'];
$message = $_POST['message'];

$email_to = 'reports.ahricraft@gmail.com';
$email_subject = "Issue with Player";
$email_body = "From: $name\n Offending player: $playerName\n Reason for report:\n $message";
mail($email_to, $email_subject, $email_body);

if ($_POST["Send"]) {
    if (mail($email_to, $email_subject, $email_body)) {
        echo '<p>Your message has been sent!</p>';
    } else {
        echo '<p>Something went wrong, go back and try again!</p>';
    }
}
?>

1 Answers1

0

(about not receiving...)

I think should be:

if ($_POST["Send"]) {

Your submit button has "Send" in name value.