# Strange PHP error on Form Processing Code

**URL:** https://forum.kirupa.com/t/strange-php-error-on-form-processing-code/332006
**Category:** programming
**Created:** [December 26, 2013, 5:04am UTC](https://forum.kirupa.com/t/strange-php-error-on-form-processing-code/332006 "2013-12-26T05:04:39Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Pherank](https://avatars.discourse-cdn.com/v4/letter/p/4af34b/32.png) [@Pherank](https://forum.kirupa.com/u/Pherank)
#### Post date: [December 26, 2013, 5:04am UTC](https://forum.kirupa.com/t/strange-php-error-on-form-processing-code/332006/1 "2013-12-26T05:04:39Z")

</div>

I’m scratching my head trying to figure out why this simple code won’t work (it’s a reduced version of code I’ve used many times successfully).

Originally I just got a blank page, but no email was sent, and the page does not redirect as specified in the code. Now I see:

```auto
**Notice** : Use of undefined constant php - assumed 'php' in **. . .** on line **1**

```

\<?php // Is data coming from our own form? // "===" compares the values to each other, and checks the type of the variable if (stristr($\_SERVER['HTTP\_REFERER'], 'splash\_form.html') === FALSE) { die('No direct script access permitted'); } else { // Does page referrer (incorrectly spelled 'referer' in the HTTP spec and in PHP) exist on the same web site as this script? // The seven characters allow for the prefix "http://". That prevents someone from using a directory on their own site with the name of your domain if (strpos($\_SERVER['HTTP\_REFERER'], $\_SERVER['HTTP\_HOST'])\>7 || !strpos($\_SERVER['HTTP\_REFERER'], $\_SERVER['HTTP\_HOST'])) { die("Bad referer"); } else { if(!empty($\_POST['extrainput'])) { die("Hello Spambot!"); } else { /// \*\*\* Get database connection info //include '../../includes/connect.php'; /// \*\*\* Final check: no empty required fields if(!empty($\_POST['first\_name']) || !empty($\_POST['last\_name']) || !empty($\_POST['email'])) { // \*\*\* Create PHP variables for special uses $message\_subject = "Sign-Up"; $email = $\_POST['email']; /// \*\*\* Build the e-mail $emailTo = 'pherank@testserver.com'; $subject = $message\_subject; $headers = 'From: website form \<'.$emailTo.'\>' . " " . 'Reply-To: ' . $email; // \*\*\* Add form values to e-mail message $message.= " "; $message.=stripslashes($\_POST['first\_name']) . " " . stripslashes($\_POST['last\_name']) . " "; $message.="E-mail: " . stripslashes($\_POST['email']) . " "; // \*\*\* Send an e-mail using PHPs mail() function mail($emailTo, $subject, $message, $headers); // \*\*\* Redirect after form is successfully submitted header("Location: thankyou.html"); exit(); } } } } ?\>

```auto

Thanks for your help.
```
