Title: Help with Syntax Error
Last modified: August 21, 2016

---

# Help with Syntax Error

 *  [Finnaus](https://wordpress.org/support/users/finnaus/)
 * (@finnaus)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/help-with-syntax-error/)
 * 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](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [13 years, 1 month ago](https://wordpress.org/support/topic/help-with-syntax-error/#post-3736702)
 * 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](https://wordpress.org/support/users/finnaus/)
 * (@finnaus)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/help-with-syntax-error/#post-3736817)
 * 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.

## Tags

 * [html](https://wordpress.org/support/topic-tag/html/)
 * [page template](https://wordpress.org/support/topic-tag/page-template/)
 * [syntax error](https://wordpress.org/support/topic-tag/syntax-error/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [Finnaus](https://wordpress.org/support/users/finnaus/)
 * Last activity: [13 years, 1 month ago](https://wordpress.org/support/topic/help-with-syntax-error/#post-3736817)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
