Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8783659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:52:39+00:00 2026-06-13T20:52:39+00:00

I am having a problem with my contact form where there is no success

  • 0

I am having a problem with my contact form where there is no success indication being given, even though the message is successfully sent to email. The form appears broken to the user because the page is unchanged when the submit button is pressed. This page was built using a Themeforest template, but the author is unable to provide a solution. I was hoping that someone could point me in the right direction.

Here is the stock ‘contact-send.php’ file I was given:

<?php


$names = $_POST['names'];
 $email = $_POST['email_address'];
 $comment = $_POST['comment'];
 $to ='to@email.com';

 $message = "";
 $message .= "*Name: " . htmlspecialchars($names, ENT_QUOTES) . "<br>\n";
 $message .= "*Email: " . htmlspecialchars($email, ENT_QUOTES) . "<br>\n";
 $message .= "*Comments: " . htmlspecialchars($comment, ENT_QUOTES) . "<br>\n";
 $lowmsg = strtolower($message);

 $headers = "MIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-1\r\n";
 $headers .= "From: \"" . $names . "\" <" . $email . ">\r\n";
 $headers .= "Reply-To: " .  $email . "\r\n";
 $message = utf8_decode($message);  mail($to, "Note from the Contact Form", $message, $headers);

 if ($message){
        echo 'sent';
 }else{
      echo 'failed';
 }
?>

This is the stock html code:

        <form id="contact-form" name="contact-form" action="" method="post">
            <label class="contact-label">Name*</label>
            <input class="contact-input" type="text" name="contact-names" value="" /><br /><span class="name-required"></span>
            <label class="contact-label">Email*</label>
            <input class="contact-input" type="text" name="contact-email" value="" /><br /><span class="email-required"></span>
            <label class="contact-label">Message*</label>
            <textarea name="comments" rows="2" cols="20" class="contact-commnent"></textarea><br /><span class="comment-required"></span>
            <input type="submit" value="Send"  id="submit-form" class="button lightred contact-submit" />
        </form>

This file is attached to the html pages as well: (juery-contact.js)

$(document).ready(function(){
    $('#submit-form').click(function(){

     var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
     var names               = $('#contact-form [name="contact-names"]').val();  
   var email_address = $('#contact-form [name="contact-email"]').val();
   var comment           = $.trim($('#contact-form .contact-commnent').val());
   var data_html ='' ;


                if(names == ""){
                     $('.name-required').html('Your name is required.');
                }else{
                     $('.name-required').html('');
                }
                if(email_address == ""){
                     $('.email-required').html('Your email is required.');
                }else if(reg.test(email_address) == false){
                     $('.email-required').html('Invalid Email Address.');
                }else{
                     $('.email-required').html('');
                }

                if(comment == ""){
                     $('.comment-required').html('Comment is required.');
                }else{
                     $('.comment-required').html('');
                }

        if(comment != "" && names != "" && reg.test(email_address) != false){

            data_html = "names="+ names + "&comment=" + comment + "&email_address="+ email_address;

            //alert(data_html);

          $.ajax({
                  type: 'post',
                  url: 'contact-send.php',
                  data: data_html,
                  success: function(msg){
                    if (msg == 'sent'){
                            $('#success').html('Message sent!')     ;
                            $('#contact-form [name="contact-names"]').val('');   
                          $('#contact-form [name="contact-email"]').val('');
                        $('#contact-form .contact-commnent').val('');

                        }else{
                            $('#success').html('Mail Error. Please Try Again.!')    ;   
                        }
                  }
            });

      }

        return false;
    })
})

Here is the live site if you need it: http://shamrockmasonry.ca/contact.html

Any help would be appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T20:52:40+00:00Added an answer on June 13, 2026 at 8:52 pm

    I glanced at the source code and noticed that there isn’t an element with ‘#success’ id.

    So this block of code that adds html message to #success element can’t do that because that element does not actually exist:

     if (msg == 'sent'){
         $('#success').html('Message sent!');
         $('#contact-form [name="contact-names"]').val('');   
         $('#contact-form [name="contact-email"]').val('');
         $('#contact-form .contact-commnent').val('');
     }else{
         $('#success').html('Mail Error. Please Try Again.!')    ;   
     }
    

    To answer your additional question you made in the comments about removing the error messages you got after successful submit do the following.

    Add additional class to your span’s, like in example here

    <span class="email-required error-message"></span>
    <span class="name-required error-message"></span>
    <span class="comment-required error-message"></span>
    

    And add this line of code to your jquery block:

    if (msg == 'sent'){
         $('#success').html('Message sent!');
         $('#contact-form [name="contact-names"]').val('');   
         $('#contact-form [name="contact-email"]').val('');
         $('#contact-form .contact-commnent').val('');
         $('.error-message').empty(); // clears all of the current error messages on success
     }else{
         $('#success').html('Mail Error. Please Try Again.!')    ;   
     }
    

    So add a div element with #success id above your form tag and you should be good.

    Hope it helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

having a problem getting my simple php email contact form working. No errors are
I am working on a contact form. Now I am having a problem when
I'm having a problem submitting my form, my code is as follows: <form method=get
I'm having a problem understanding how to find a contact in the Mac Address
I am having a problem filter a query. I have a Contact and a
My website stephenharman.com is having some issues with it's contact form. I use a
I am having problem with this contact retrieving code. The function getContact() is retuning
Having problem with the middle Div not expanding to the width http://acs.graphicsmayhem.com/images/middiv.jpg Ok, how
Im having problem in my UIscrollView ,this is what I have done: Whenever a
I am having problem using mvc:resources in spring 3.1 configuration. Initially i was working

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.