Jump to content

Recommended Posts

Posted

Hi all,

 

I found the following php email form online and was able to use it, however, I wanted to ask how I can make it check that the email contains an "@" sign. It only checks that the email box not be empty (right?).

 

<?php

$to = "zulema_ortiz@zoblue.com";

$from_header = "From: $Name <$Email>";

if($Email != "") {

mail($to,"Subject","\n$Name\n$Email\n\nComments...\n$Message\n",$from_header);

       print ("<b>Your note has been sent!  Send another if you like!</b><br>");

}

else {

      echo "<b>Send me a note!</b><br>";

}

?>

<form method="POST" action="<? echo ($PHP_SELF); ?>">

 

Name:    <input type="text" name="Name" size="30" maxlength="30">

E-mail:  <input type="text" name="Email" maxlength="30" size="30">

Message:

         <textarea name="Message" wrap rows="5" cols="30"></textarea>

 

         <input type="submit" name="submit" value="Send">       <input type="reset" name="reset" value="Clear">

 

</form>

 

I know it should go in the * if($Email != "") * line, but I don't know how it should be worded. I want it to check if the text in the email box has an @ sign somewhere in it. It's prolly the easiest thing, but I don't know php!

 

any help is appreciated :) ,

!!blue

 

Posted

There is a script I co-wrote in the scripting forum called Ultimate Form Mail Script. You can either 'borrow' the regex function that validates the email, or you may use the script as is.

 

No sense reinventing the wheel.

Posted

 

Surefire, thank you!

 

I will see what I can learn from your files and hopefully I will make it work. :)

 

later,

!!blue

 

Posted

just checked it out surefire.

Awsome script. . . now I'll have another sleepless night coding it into my site. :)

Thumbs Up

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...