# PHP form emails not received

**URL:** <https://forum.kirupa.com/t/php-form-emails-not-received/270656>\
**Category:** programming\
**Created:** [September 12, 2008, 2:45am UTC](https://forum.kirupa.com/t/php-form-emails-not-received/270656 "2008-09-12T02:45:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![khujo56](https://avatars.discourse-cdn.com/v4/letter/k/13edae/32.png) [@khujo56](https://forum.kirupa.com/u/khujo56)\
**Post date:** [September 12, 2008, 2:45am UTC](https://forum.kirupa.com/t/php-form-emails-not-received/270656/1 "2008-09-12T02:45:00Z")

</div>

HI Guys

I followed this tutorial on how to create a php form. The problem i have is that when i fill in the info and click send, everything appears well but the info is not being sent to the assigned e-mail. I’m not sure what is wrong. Hopefully someone can catch error. Your help is greatly appreciated.

[SIZE=2]\<?php  
error\_reporting(E\_ALL);

// Function to display form

```
  function showForm($errorName=false,$errorEmail=false){

  if ($errorName) $errorTextName = "Please enter your name!";

  if ($errorEmail) $errorTextEmail = "Please enter a valid email address!";

   
  echo '&lt;form action="form.php" method="POST"&gt;&lt;table&gt;';

  // Display name field an error if needed

  echo '&lt;tr&gt;&lt;td&gt;Name:&lt;/td&gt;&lt;td&gt;&lt;input type="text" name="name"&gt;&lt;/td&gt;&lt;/tr&gt;';

  if ($errorName) echo "&lt;tr&gt;&lt;td colspan='2'&gt;$errorTextName&lt;/td&gt;&lt;/tr&gt;";

  // Display email field an error if needed

  echo '&lt;tr&gt;&lt;td&gt;Email:&lt;/td&gt;&lt;td&gt;&lt;input type="text" name="email"&gt;&lt;/td&gt;&lt;/tr&gt;';

  if ($errorEmail) echo "&lt;tr&gt;&lt;td colspan='2'&gt;$errorTextEmail&lt;/td&gt;&lt;/tr&gt;";
   
  echo '&lt;tr&gt;&lt;td&gt;&lt;input type=submit name="send" value="Submit"&gt;&lt;/td&gt;&lt;/tr&gt;';

  echo '&lt;form&gt;';

  }

if ( isset($_POST["Submit"]) ) { 

```

$email = $\_POST[‘email’];  
$subject = ‘your subject here’;  
$message = ‘your message’;  
$reply\_to = ‘jnr1975@hotmail.com’;  
$from = ‘you@yourdomain.com’;

mail( $email, $subject, $message, “From: {$from}  
Reply-to: {$reply\_to}” );

```
  } else {

  //Init error variables

  $errorName = false;

  $errorEmail = false;

   

  $name = isset($_POST['name']) ? trim($_POST['name']) : '';

  $email = isset($_POST['email']) ? trim($_POST['email']) : '';

   

  if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) $errorEmail = true;

  if (strlen($name)&lt;3) $errorName = true;

   

  // Display the form again as there was an error

  if ($errorName || $errorEmail) {

  showForm($errorName,$errorEmail);

  } else {
  

  echo 'Thamk you for signing up!';
  echo "&lt;meta http-equiv='refresh' content='0;url=http://www.iheartvacation.com'&gt;";
  }
 

  }

  ?&gt; [/SIZE]
```
