troubleshooting Question

Vailidate E-mail Field

Avatar of emory7
emory7 asked on
2 Comments1 Solution281 ViewsLast Modified:
Hi All,
I need to validate the e-mail field on a simple subscribe request form. I want a pop-up warning the user to enter a valid e-mail address if, say, the "@" character is not entered. I appreciate your help.

Script in mail.php:
$message="$email requests to be added to the mailing list.";
if(mail($to,"Subscribe Request",$message,"From: $email\n")) {
echo "Thanks for subscribing to the mailing list.";
} else {
echo "There was a problem sending the mail. Please check that you filled in the form correctly.";

  <table id="table4" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="125" height="37">
    <td width="126" height="1" valign="top" bgcolor="#99CC00">
    <p align="center">
    <h4 align="center"><span lang="en-us">Subscribe</span>
    <td width="126" height="85" valign="top" align="center">
    <form action="mail.php" method="post">
<p><span lang="en-us">Enter your e-mail to receive  news&nbsp;and updates </span>
<input type="text" name = "email" size="12" value="" <input type="submit" value="Submit"></p>

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros