The code I'm using is turning an error message even if the email field is left blank.
Here's the original code:
Expand|Select|Wrap|Line Numbers
- if (eregi ('^[[:alnum:]][a-z0-9_\.\-]*@[a-z0-9\.\-]+\.[a-z]{2,4}$', stripslashes(trim($_POST['email']))))
- {
- $e = escape_data($_POST['email']);
- }
- else
- {
- $e = FALSE;
- echo "<tr><td align='left'><span style='font-size:14px; color:red; font-weight:bold;'>Please enter a valid email address.</span></td></tr>";
- }
Expand|Select|Wrap|Line Numbers
- if (!empty($_POST['email']))
- {
- if (eregi ('^[[:alnum:]][a-z0-9_\.\-]*@[a-z0-9\.\-]+\.[a-z]{2,4}$', stripslashes(trim($_POST['email']))))
- {
- $e = escape_data($_POST['email']);
- }
- else
- {
- $e = FALSE;
- echo "<tr><td align='left'><span style='font-size:14px; color:red; font-weight:bold;'>Please enter a valid email address.</span></td></tr>";
- }
- }