Question:

Need Help With Email Script?

by  |  earlier

0 LIKES UnLike

In My script, i need to validate whether or not all the text boxes are filled out. And if they arent, i want some sort of message or for it to go back, it really doesnt matter to me as long as it doesnt send and i can echo a message saying something like please be sure to fill out all fields.

Also, i want in the From Section to Make sure the user puts the @ symbol in the textbox, because like i said, its an email form and if there isnt an @ symbol it says its from the website. so i just need the @ symbol to be there or else it echos something like please check your from email address

If it helps, my variables are:

$to

$subject

$message

$from

then in the part that actually sends, i have

$headers = "From: $from\r\n";

mail($to,$subject,$message,$headers);

$theresults = (the rest)

 Tags:

   Report

1 ANSWERS


  1. <script type='text/javascript'>

    function emailValidator(elem, helperMsg){

    var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z...

    if(elem.value.match(emailExp)){

    return true;

    }else{

    alert(helperMsg);

    elem.focus();

    return false;

    }

    }

    </script>

    <form>

    Email: <input type='text' id='emailer'/>

    <input type='button'

    onclick="emailValidator1(document.get... 'Not a Valid Email')"

    value='Check Field' />

    </form>

    Using this javascipt will be better.

    This will match what you said.

    If people did not put @ It will make a pop up to tell them "Not a Valid Email'.

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.