Jump to content

Search the Community

Showing results for tags 'php jquery email send'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hi I have a following code, validation part and jquery works perfectly in the code but it dosent send the email I have jquery.js file in the head section of html and it work perfectly contact.php <div id="emailcontainer"> <div id="ack"> </div> <div id="emailsend"><img src="images/emailsend.gif"></img><br> <p>We will get back to you soon</p></div> <form id="contactform"> <div> <label for="name">NAME:</label> <input type="text" name="name" id="name" placeholder="John Doe" /> </div> <div> <label for="email">EMAIL:</label> <input type="text" name="email" id="email" placeholder="JohnDoe@example.com" /> </div> <div> <label for="comment">MESSAGE:</label> <textarea name="comment" rows="10" cols="50" id="comment"></textarea> </div> <input type="submit" name="submit" value="SEND" id="submit" /> </form> </div><!---div emailcontainer end here---> </div><!---div main end here---> this page does the validation part from php test.php <?php if(isset($_POST["submit"])) { $errors = array(); $name = $_POST['name']; $email = $_POST['email']; $comment = $_POST['comment']; $to = "reboosttechnologies@gmail.com"; $from = $_POST['email']; $headers = "From: $from"; $flag = false; $success = mail($to,$comment,$headers); $emailReg = '/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/ '; if(!($name) || !($email) || !($comment)){ if(!$name){ $errors[]="Missing Name"; } if(!$email){ $errors[]="Missing Email"; } if(!$comment){ $errors[]="Missing Comment"; } $json_response = json_encode($errors); }elseif(!preg_match($emailReg,$email)){ $errors[] = "Not a valid email address"; $json_response = json_encode($errors); }elseif($success){ $flag = true; return $flag;}else{ $json_response = json_encode("Thanks for your comment"); } echo $json_response; } ?> this file does the jquery validation without page refresh function.js $(function(){ $("#emailsend").hide(); $("#submit").click(function(event) { event.preventDefault(); var emailReg = /^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/; var errors = false; var name = $('[name=name]').val(); var email = $('[name=email]').val(); var comment = $('[name=comment]').val(); $('.errors').remove(); if($("#name").val() == ""){ $("#name").after("<span class= 'errors'> Missing Name </span>"); errors = true; } if($("#email").val() == ""){ $("#email").after("<span class= 'errors'> Missing Email </span>"); errors = true; }else if(!emailReg.test($('#email').val())){ $("#email").after("<span class= 'errors'> Not valid Email </span>"); errors = true; } if($("#comment").val() == ""){ $("#comment").after("<span class= 'errors'> Missing Comment </span>"); errors = true; } if(errors == true) { return false; } else { input_data = { "name" : name, "email" : email, "comment": comment, "submit" : true } $.ajax({ type: 'post', url: 'test.php', data: input_data, dataType: 'json', success: function( msg ) { $("#ack").html(msg); $("#contactform").delay(500).slideUp(500); $("#emailsend").show(700); }, error: function() { $("#ack").html('ERROR!'); } }); } }); });
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.