I created a process form that inserts values from one php page into the database. I would like to email the results of the form to several users using some type of authentication method. I thought I could achieve this with `mysql_query()`, but it plugs in the data, but isn't sending a email.

```
$sql = insert query
$connection = mysql_connect

```

I used:

```
if (!mysql_query($sql,$connection))
 {
     die('Error' . mysql_error());
 }

```

I tried to insert `mail()` after the if statement, but it doesn't work. If I insert `mail()` after the die statement anyone is able to process the file and send emails. How can I get this to work? Any help is appreciated.