• Hi everyone, so I’m pretty new to HTML coding, and I’ve created a Page Template, and I’m trying to get this HTML to work. Basically, this is a script for spamming, I’m using it as a prank on my friends, and I just can’t get it to work.

    This is the Error I’m getting:

    Parse error: syntax error, unexpected ‘<‘ in /home/content/07/9830807/html/wp-content/themes/easel/spampage.php on line 5

    And here is the code I’m using:

    <?php
    /*
    Template Name: Spam
    */
    <!DOCTYPE html>
    <html>
    <form action="spam.php" method="POST">
    To: <input type="text" name="to" /> <br />
    Subject: <input type="text" name="subject" /> <br />
    Message: <input type="text" name="message" /> <br />
    From: <input type="text" name="from" /> <br />
    Times To Send: <input type="text" name="sendtimes" /> <br />
    <input type="submit" value="Send!" />
    </form>
    </html>
    ?>

    and here is the actual script:

    <?php
    $number = 0;
    $to = $_POST['to'];
    $subject = $_POST['subject'];
    $message = $_POST['message'];
    $from = $_POST['from'];
    $headers = "From: $from";
    $sendtimes = $_POST['sendtimes'];
    
    while ($number < $sendtimes) {
    $number++;
    mail($to,$subject,$message,$headers);
    }
    echo "Mail Sent $sendtimes times!";
    ?>

    Any help would be greatly appreciated!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    You can’t have HTML like that in a PHP file.
    Use this instead:

    <?php
    /*
    Template Name: Spam
    */
    ?>
    <!DOCTYPE html>
    <html>
    <form action="spam.php" method="POST">
    To: <input type="text" name="to" />
    Subject: <input type="text" name="subject" />
    Message: <input type="text" name="message" />
    From: <input type="text" name="from" />
    Times To Send: <input type="text" name="sendtimes" />
    <input type="submit" value="Send!" />
    </form>
    </html>

    Thread Starter Finnaus

    (@finnaus)

    Thank you very much Andrew! Just a quick question, it’s fine if you don’t know the answer: when I submit the form, it is supposed to run the script, but instead I just get a 404 page not found..do you know how I would get this HTML form to run the script?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Help with Syntax Error’ is closed to new replies.