Contact form response message not working

So i am trying to move the location of my response message after the send button has been hit by the user. It comes up at the top of the screen but I want it to appear in a div just below. I read that using javascript should work. Here's what ive put:
PHP:
<?php
if ($_POST){
if (!filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL)){
$message="Please provide a correct email address";} else {
  $fname = strip_tags($_POST['fname']);
  $sname = strip_tags($_POST['sname']);
  $telephone = strip_tags($_POST['tel']);
  $email = $_POST['email'];
  $comments = strip_tags($_POST['comments']);
  $to = '[email protected]';
  $subject = 'Contact form submitted.';
  $body = $fname. "\n". $sname. "\n". $comments;
  $headers = 'From: ' .$email;
  if (mail($to, $subject, $body, $headers)) {
  echo 'Thanks for contacting us. We\'ll be in touch soon!';
  } else {
  $message = 'Sorry an error occurred. Please try again later.';
?>
<?php echo "<p style='color:red'>$message</p>"; ?>
Form:
<div class="contact_form">
<table class="table">
  <tbody>
<form id="contactForm" action="" method="post">
    <tr>
      <th scope="row">First Name:</th>
      <td><textarea name="fname"  cols="100" rows="3" id="fname"></textarea></td>
    </tr>
    <tr>
      <th scope="row">Surname:</th>
      <td><textarea name="sname" cols="100" rows="3" id="sname"></textarea></td>
    </tr>
    <tr>
      <th scope="row">Email Address:</th>
      <td><textarea name="email" cols="100" rows="3" id="email"></textarea></td>
    </tr>
    <tr>
      <th scope="row">Telephone Number:</th>
      <td><textarea name="tel" cols="100" rows="3" id="tel"></textarea></td>
    </tr>
    <tr>
      <th scope="row">Comments:</th>
      <td><textarea name="comments" cols="100" rows="10" id="comments"></textarea></td>
    </tr>
    <tr>
      <th scope="row"></th>
      <td height="40px"><input type="submit"></td>
    </tr>
    <tr>
    </form>
    </tr>
  </tbody>
</table>
Javascript:
<script type="text/javascript" src="morris_construction/jquery-1.11.2.min.js"></script>
<script>
     $("#contactForm").submit(function(event)
         /* stop form from submitting normally */
         event.preventDefault();
         /* get some values from elements on the page: */
         var $form = $( this ),
             $submit = $form.find( 'button[type="submit"]' ),
             fname_value = $form.find( 'input[name="fname"]' ).val(),
  sname_value = $form.find( 'input[name="sname"]' ).val(),
  tel_value = $form.find( 'input[name="tel"]' ).val(),
             email_value = $form.find( 'input[name="email"]' ).val(),
             comments_value = $form.find( 'textarea[name="comments"]' ).val(),
             url = $form.attr('action');
         /* Send the data using post */
         var posting = $.post( url, {
                           fname: fname_value,
    sname: sname_value,
    tel: tel_value,
                           email: email_value,
                           comments: comments_value
         posting.done(function( data )
             /* Put the results in a div */
             $( "#contactResponse" ).html(data);
             /* Change the button text. */
             $submit.text('Sent, Thank you');
             /* Disable the button. */
             $submit.attr("disabled", true);
</script>
</div><!-- end of contact form -->

No javascript needed or desired for this solution.
Instead of
echo 'Thanks for contacting us. We\'ll be in touch soon!';
  } else {
echo 'Sorry an error occurred. Please try again later.';
make them variables, like this:
$message = 'Thanks for contacting us. We\'ll be in touch soon!';
  } else {
$message = 'Sorry an error occurred. Please try again later.';
Then, in the location where you want the message to appear. . .
<?php echo $message ?>

Similar Messages

  • Phone version: Contact form "Send" button not working

    The "Send" button on the contact form works when used through a laptop browser, but doesn't work in a cell phone browser.  I've tried it with an iPhone 6 and Samsung Dart.  Any help is appreciated.
    Phone:
    http://www.landcordesign.com/phone/index.html
    Desktop / Laptop:
    http://www.landcordesign.com/index.html
    Thanks for the help,
    Jack

    Sanjit,
    I uploaded the file to box.com (Adobe Muse - Box).  Let me know what I need to do to fix the problem.
    Thanks,
    Jack

  • Contact form on mobile not working

    The contact form works great on the desktop, but then if you make a mobile version (or as muse calls is, phone) once the site is published, you can't click inside the contact form in order to submit anything.  Can someone please help, or perhaps direct me to a contact form solution that works?
    To check out what I'm talking about, pull our your phone and bring up the page I'm working on:
    www.fortworth148.org
    If you navigate to the contact us section, you will find the trouble.
    Thanks in advance for any feedback.

    Hi,
    it is because the menu is overlapping the Webform, check this screenshot
    Do let me know if you have any question.

  • Response Groups not working

    Hi there
    My environment is a single Lync 2013 Front End Server installed on Server 2012.
    It works since a year and now we want to use some response groups. I created 2 of them and everything seems fine but i cant call these groups. Not from internal and also not from external.
    The clients shows an 500 internal server error with ID 26017.
    So i traced the whole thing on the Front End Server. It seems the Response Group Service cant work with the local SQL Server. I see three error messages.
    1. TL_ERROR(TF_COMPONENT) [2]0B90.37A8::07/23/2014-06:38:39.119.000002fb (RgsClientsLib,MatchMakingLocator.GetActiveInstanceFromDB:683.idx(479))
    (0000000000150BA8)No instance registered as the active instance!
    2. TL_ERROR(TF_COMPONENT) [1]1E08.2910::07/23/2014-06:38:42.462.00000a34 (RgsHostingFramework,CallControlManager.HandleAudioVideoCall:2049.idx(619))
    (000000000362D054)Call is declined because Call Control is not started.
    3. TL_WARN(TF_COMPONENT) [1]0B90.0B7C::07/23/2014-06:38:48.053.00000f2d (RgsClientsLib,MatchMakingLocator.GetActiveMatchMakingInstance:683.idx(301))
    (0000000000150BA8)There is currently no active MatchMaking instance in the pool.
    The Lync Server Event Log shows this error when the Response Group Service starts:
    LS Response Group Service ID 31067
    Lync Server 2013, Response Group Service Match Making could not find the Contact object used for subscribing to agents' presence.
    Cause: The application has not been properly activated or the Contact object was deleted.
    Resolution:
    Deactivate and then activate the application for this pool.
    Is there a way to reinstall / reconfigure the whole response group service incl. the active directory objects?
    I hope somebody could help
    Regards
    Andreas

    Have you seen this thread:
    http://social.technet.microsoft.com/Forums/lync/en-US/cd25ddec-6e1e-4d58-9a9a-a530abfa82e3/response-groups-not-working?forum=ocsclients ?
    He ran Get-CsApplicationEndpoint and received a warning that let him to a resolution.
    Short of that, I'd rerun step 2 in the deployment wizard and restart services when you can to see if I could jog anything loose.
    Please remember, if you see a post that helped you please click "Vote As Helpful" and if it answered your question please click "Mark As Answer".
    SWC Unified Communications

  • In dev server my payment advice form f110_prenum_chc  is not working

    hi,
    friends i need urgent help.
    1) i have copied f110_avis_in frm 000 client to 200 client with form name
       z_prenum_dup.
    2) i have copied f110_prenum_chc frm 000 client to 200 client form name
      zf110_prenum_chc1.
    3) then i modified my both forms in 200 saved assigned TRs and
    transported frm DEV server to PRD server(client 700).
    4)in dev server 200 client my both forms are working
      but in prd server 700 client my form cheque z_prenum_dup is
      working but payment advice form zf110_prenum_chc1 is
    not working.
    5) but i can see my both forms r their in 700 prd server in se71 t.code.
    6) if i run f-58 tr.code and by switching on debug mode i can see my
       cheque form but not payment advice form.
    7) if i run in 200 client i can see my both forms.
    can any body plz help me out of this issue.

    Dear,
       I will be able to put some points, if you can give me some more idea about ur problem,
    1, Does system giving any error..?
    2, Can you see a preview..?
      As I understood, it must not have any problem in transportation.
      You can also check with Respective functional consultant whether he has done with required customization in NACE..?
      One more thing you can do is,
      open a program RSNAST00 and put break point at "  PERFORM (tnapr-ronam) IN PROGRAM (tnapr-pgnam) USING returncode", here you can check at runtime ( While in debugging mode) the value of field TNAPR-FONAM, this value must be your SmartForm.  If it is not the case then, there is problem with NACE settings and contact your functional counterpart.
    Hope it's helpful .......Enjoy.
    Regards,
    Chetan

  • [svn:bz-trunk] 16395: Bug: #2621264 [Regression] Small messages not working with NIO-HTTP endpoints in LCSD/trunk.

    Revision: 16395
    Revision: 16395
    Author:   [email protected]
    Date:     2010-06-02 05:00:56 -0700 (Wed, 02 Jun 2010)
    Log Message:
    Bug: #2621264 Small messages not working with NIO-HTTP endpoints in LCSD/trunk.
    QA: Yes
    Doc: No
    Checkintests: Pass
    Details: This is the BlazeDS side of the fix. This wasn't a regression, it probably never worked correctly. So, in the scenario where there's a Producer and a Consumer, and Producer sends a message for the Consumer, there are 2 messages from the server. The ACK message for Producer's send, and the actual message Consumer receives. I found that the ACK message was in small form, but the actual message was not in streaming messages. This was because we never really tried to convert streamed messages into small messages before.
    Modified Paths:
        blazeds/trunk/modules/core/src/flex/messaging/endpoints/BaseStreamingHTTPEndpoint.java
        blazeds/trunk/modules/core/src/flex/messaging/endpoints/StreamingAMFEndpoint.java
        blazeds/trunk/modules/core/src/flex/messaging/endpoints/StreamingHTTPEndpoint.java

  • IOS Group Messaging not working when Android phones are involved

    Group Messaging not working for me when there are both Iphones and Androids involved. iPhones still using iOS 7 don't seem to be having problems leading me to believe this is an iOS 8 problem. Is there a workaround for this yet, or is this a legitimate bug fix that Apple will have to address?

    Hey geoff_zen,
    Thanks for the question. After reviewing your post, it sounds like you arr having trouble with group messages. I would recommend that you read this article, it may be able to help you resolve or isolate the issue.
    iOS: Troubleshooting Messages
    To resolve issues with sending and receiving iMessages, follow these steps
    Check iMessage system status for current service issues.
    Go to Settings > Messages > Send & Receive and make sure that you registered iMessage with your phone number or Apple ID and that you selected iMessage for use. If the phone number or Apple ID isn't available for use, troubleshoot iMessage registration.
    Open Safari and navigate to www.apple.com to verify data connectivity. If a data connection isn't available, troubleshoot cellular data or a Wi-Fi connection.
    iMessage over cellular data might not be available while you're on a call. Only 3G and faster GSM networks support simultaneous data and voice calls. Learn which network your phone supports. If your network doesn't support simultaneous data and voice calls, go to Settings > Wi-Fi and turn Wi-Fi on to use iMessage while you're on a call.
    Restart your device.
    Tap Settings > General > Reset > Reset Network Settings on your iPhone.
    If you still can't send or receive an iMessage, follow these steps
    Make sure that the contact trying to message you isn't blocked in Settings > Messages > Blocked.
    Make sure that the contact you're trying to send a message to is registered with iMessage.
    If the issue occurs with a specific contact or contacts, back up or forward important messages and delete your current messaging threads with the contact. Create a new message to the contact and try again.
    If the issue occurs with a specific contact or contacts, delete and recreate the contact in the Contacts app. Create a new message to the newly created contact and try again.
    Back up and restore your device as new.
    Thanks for using Apple Support Communities.
    Have a nice day,
    Mario

  • Is it still the case that the Muse CC Forms widget will not work properly unless you have Business Catalyst?

    I am looking into options for our next office website redesign.  We will definitely need a forms function.  I downloaded the Muse CC free trial and went through all of the tutorials.  The video on the forms (Contact Form) stated that the forms widget would not work or would not work properly if you do not have Business Catalyst.  I'm hoping that has changed since the video was created.
    Is this still true that you need to purchase the Business Catalyst product for Muse CC form widgets to work correcty??? 

    Piruki have you tried utilizing the Previous version option within the Creative Cloud Desktop application?  You can find additional details under the install Previous version section of CC desktop lists applications as "Up to Date" when not installed - http://helpx.adobe.com/creative-cloud/kb/aam-lists-removed-apps-date.html.

  • HT5012 Update my iPad to ios7.1 and messaging not working  .......suggestions?

    Updated my iPad Air to ios7.1. Messaging not working. Suggestions????

    What happens when you try? Getting an error message?
    Try this  - Reset the iPad by holding down on the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. (This is equivalent to rebooting your computer.) No data/files will be erased. http://support.apple.com/kb/ht1430
     Cheers, Tom

  • Infopath form load rule not working in browser forms but works on Client

    Hi
    I am working on an Infopath form and there are rules on form load. The form load checks for a value in a list, if the username() matches the one in the list, then the form would change its view.
    It works when I open it on client, but on the browser it fails.
    Have anyone encountered such an issue.

    Check below:
    http://stackoverflow.com/questions/16222681/infopath-rule-is-not-running-when-checking-sharepoint-list-field-value
    Ensure that "Include data for the active form only" was checked (I had to separate this field into another data connection because that box could not be checked for another field I was using), and
    Ensure that in the rule I was selecting from the "dataFields" folder under the data connection instead of "queryFields"
    http://sharepoint.stackexchange.com/questions/28554/infopath-form-load-rules-not-working
    if I edit the Infopath form on Infopath 2007, it seems that the rules for the load form will be visible if created.
    This look like a bug. Here are the steps below that will lead you to the bug:
    Step 1: Open the infopath form in Infopath 2010 and create 6 rules for Form Load and Save it as a file.
    Step 2: Open that infopath form that you created in Step 1 in InfoPath 2010 and go to the
    Form Load section. You will only see the first 5 rules. The 6th rules that you created for Step 1 will just "vanish". Now, close that infopath form.
    Step 3: Open that infopath form that you created in step 1 in InfoPath 2007 and select Tools > Form Option. In the
    Open and Save category, click the Rules button and add a new rule in it and save it.
    Step 4: Open that infopath form that you modify as describe in Step 3 in InfoPath 2010. That 6th rule will be visible.
    Therefore, there might be a bug in InfoPath 2010 that restrict Rules to a max of 5 in Form Load and thus if anyone open that form in SharePoint, only the first 5 rules will be executed.
    If this helped you resolve your issue, please mark it Answered

  • I have a 3gen iPod message not working any solutions

    I have a 3 gen iPod messages not working any solution

    Start here:
    iOS: Not responding or does not turn on
    You are not really giving ups much information to provide more detailed advice.

  • Anyone's I Message not working this morning?

    Is your I Message not working this morning?

    I've been using mine all morning.
    https://www.apple.com/support/systemstatus/

  • I am actually using a free trial of photoshop cc and the contact sheet option does not work-?

    i am actually using a free trial of photoshop cc and the contact sheet option does not work...

    Hi dmomoney24  ,
    Kindly refer : CC desktop lists applications as "Up to Date" when not installed.
    Please revert if the problem persists.
    Thanks,
    Atul Saini

  • E7 Nokia Messaging not working after anna update

    hi
    nokia messaging not working after anna update. when i
    -choose provider (hotmail/gmail/yahoo...etc)
    -enter username & password
    -click OK to T&C
    -get error message: "cannot enable this service on the device"
    any ideas?

    I'm having a similar issue. It appears to only impact Hotmail accounts. For me though, this happened without updating the OS. The email client is simply failing to connect to the Hotmail interface. Only two possibilities, either Microsoft changed something on the email gateway or Nokia changed something on their end. Either way, it's not working and has been out of commission for the past week. If this is how corporate friends get along, I'd hate to see what happens in a adversarial relationship.

  • Share contact by message not working

    Just got an iphone 5.  I am trying to share some contacts by message.
    When I tap share contact and select message as the method to share, nothing happens.  The message app does not launch or anything.
    Message is setup and working otherwise.
    Any thoughts?
    Thanks.

    Nevermind. A reset did the trick.

Maybe you are looking for

  • Problems with deploy on OC4J 10.1.3.2 with hibernate persistence.xml

    Hi all, I can't deploy an EAR/WAR into oc4j 10.3.2.0 stand-alone, I have the following error message : 2008-03-26 19:50:38.721 NOTIFICATION Binding opsky-webapp-1.0-SNAPSHOT web-module for application opsky to site default-web-site under context root

  • M60 Shutdown without user action

    Hello, i use a Satellite M60 Notebook with Win XP and i bought this notebook on 11/15/2005. I use an actuell anti-virus software and some anti-sypware tools. But from the first use of the notebook it shutdown without user action. I can't solve the pr

  • Override vs. Overrides

    In JDK 1.5 Beta 1, there was a new annotation type, @java.lang.Overrides. In Beta 2, this has changed to @java.lang.Override. Will this change be permament, or will it be changed back? Also, why was it changed?

  • How do I attach a calendar icon to a date field?  Is it not default?

    I expected to see the calendar icon when I used the date field in FormsCentral.  I thought it would be the default option. 

  • ADF create/edit in single form

    Hi to every one i have one .jspx file ....... i have to use same adf form for both create and edit operation .....is it possible (in adf creation form ..we cant use for edit operation as well as In the adf form we cant use for create function....and