Thanks James, but I get a syntax error when I use that code. I do like your idea of sending a confirmation email to the sender of the form, but I am not sure exactly how to do that.
Diane --- In php-list@yahoogroups.com, James Keeline <[EMAIL PROTECTED]> wrote: > > --- On Sat, 10/18/08, Diane <[EMAIL PROTECTED]> wrote: > > > What specific code would I have to add to make my contact > > form only accept an E-Mail Address where it is asked for? > > Right now it will accept anything: > > There are two issues here. The first is, do you want to check to see is a string of characters looks like a proper email address (eg [EMAIL PROTECTED])? Or, do you want to ensure that it is a valid email address? > > For the first you can use a regular expression to see if it looks like an email address. > > if (preg_match("/[EMAIL PROTECTED]/", $email) > { > print "looks like an email"; > } > else > { > print "does not look like an email"; > } > > You should check to see if it looks like an email in either case. To see if it is a working email, you should send a message which contains a URL that will let them indicate that the message has been received. There are several ways to accomplish this. The URL you give should point to a PHP script with GET variables that you are expecting to see. The link should probably only work one time to avoid abuse. > > James >