title: php expression for only lowercase and underscore for email validation
body: <p>I am trying to have users sign up with a desired email. But I dont want them to have to input the <code>'@domain.com'</code>, I just want them to input the username, (everything to the left of <code>'@'</code> ). Also, how would I go about making sure that the only characters to the left are lowercase letters, numbers and an underscore? Basically if they enter a capital letter, it should lower it. I do know about <code>strtolower</code>, but just don't quite know how to implement it in my script. I only want my script to be able to validate one domain, in this example <code>'domain.com'</code></p>
  
  <p>My script needs these fields populated</p>
  
  <pre><code>$email = ($_POST['email']);
  </code></pre>
  
  <p>and this checks if it is valid</p>
  
  <pre><code>if(!filter_var($email, FILTER_VALIDATE_EMAIL)){
                  echo "You have entered an invalid email. Press back and try again.";
                  $db = null;
          exit();
          }
  </code></pre>
  
  <p>So I know I need to do something with the <code>$email</code> variable. Sorry am a bit new to php</p>