Question: ```
<?php
if (isset($_POST['ign'], $_POST['email'])) {
    if($_POST['ign'] && $_POST['email']){

    }
    else {
        echo ("Please enter all of the values!");
    }
}
else {
    echo ("Error in form data!");
}
if((FILTER_VALIDATE_EMAIL($_POST['email'] == TRUE))) {
    $email = $_POST['email'];
    echo ("Thanks, " . htmlentities($_POST['ign']) . ", you will recieve an email when the site is complete!");
}
else {
    echo "Failure!";
}

// insert email and ign into database
?>

```

Is this going to work correctly? First time doing something completely from scratch lol!

OK! I have changed it. What about this? Should I also do the empty thing?

```
<?php
if (!isset($_POST['ign'], $_POST['email'])) {
    if($_POST['ign'] && $_POST['email']){
    echo "Please fill out all of the fields!";
        die;
}
if(var_filter($_POST['email'], FILTER_VALIDATE_EMAIL))
    $email = $_POST['email'];
    echo ("Thanks, " . htmlentities($_POST['ign']) . ", you will recieve an email when the site is complete!");
}
else {
    echo "Your email was invalid!";
}

// insert email and ign into database
?>

```

Answer: 
Wrap it with some defensive logic: 

```
if(!empty($_POST['streamname'])) {

    // Your code here
}

```
You should be escaping the input.

```
$sql='INSERT INTO streams (streamname)
VALUES ("'.mysql_real_escape_string($_POST[streamname]).'")';

```