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 6695561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:14:11+00:00 2026-05-26T06:14:11+00:00

This is my contactus.html page. I am submitting to a php page on the

  • 0

This is my contactus.html page. I am submitting to a php page on the server that is to take the information and send email alongw ith saying thank you. When I do submitthe form, all I see is “undefined” on screen even though I am able to get the email.

<!DOCTYPE html> 
<html> 
    <head> 
    <title>Contact Us</title> 
    <link rel="stylesheet" href="css/latestjquerymobile.css" />
    <link rel="stylesheet" type="text/css" href="css/jquery.mobile.simpledialog.min.css" />

    <script type="text/javascript" src="js/jquery-1.6.1.min.js"></script>
    <script type="text/javascript" src="js/latestjquerymobile.js"></script>
    <script type="text/javascript" src="js/jquery.mobile.simpledialog.min.js"></script>


    <script type="text/javascript">
    $(document).ready(function() { 

                     $("#contactus").submit(function(event) {

                     alert("page submitted");


 })

});
</script>
</head> 
<body> 

<div data-role="page" data-theme="e" id="contactus">

    <div data-role="header" data-position="fixed">
        <h1>Contact Us</h1>
        <a href="home.html" data-icon="back" class="ui-btn-left" data-ajax="false">Back</a>
        <a href="home.html" data-icon="home" class="ui-btn-right" data-ajax="false">Home</a>
    </div><!-- /header -->

    <div data-role="content">   

    <div align="center">





    <form action="http://testsite.com/contactus.php" name="contactus" id="contactus" method="post">


    <fieldset>



        <div data-role="fieldcontain">

        <label for="name"> Name:</label>    
        <input id="name" name="name" type="text" />

        <label for="email">Email:</label>       
        <input id="email" name="email" type="text" />


        <label for="contact">Contact:</label>   
        <input id="contact" name="contact" type="text" />


        <label for="message">Message:</label>       
        <textarea rows="4" cols="50" id="message" name="message"></textarea>

        <br />
        <button type="submit" name="submit" value="submit-value">Send</button>


        </fieldset>
    </div>
    </form>




     <div><br><br>


      <a href="http://www.facebook.com/Apsession"><img src="images/facebook.png" border="0" /></a>

    <a href="http://twitter.com/ApsessionMobile"><img src="images/twitter.png" border="0" /></a>


     </div>




    </div>

    </div><!-- /content -->

</div><!-- /page -->

</body>
</html>

This is the code for contactus.php on server

<?php 
$ToEmail = 'test@testemail.com'; 
$EmailSubject = 'Contact Form Submission from testsite.com'; 
$mailheader = "From: ".$_POST["email"]."\r\n"; 
$mailheader .= "Reply-To: ".$_POST["email"]."\r\n"; 
$mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n"; 
$MESSAGE_BODY = "Name: ".$_POST["name"]."<br>"; 
$MESSAGE_BODY .= "Email: ".$_POST["email"]."<br>"; 
$MESSAGE_BODY .= "Contact: ".$_POST["contact"]."<br>";
$MESSAGE_BODY .= "Message: ".$_POST["message"]."<br>"; 
mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure"); 
?>
<html>
<body>

THANK YOU

</body>
</html>
  • 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-05-26T06:14:11+00:00Added an answer on May 26, 2026 at 6:14 am

    I’m not sure why you’re seeing undefined, but I noticed you are not preventing the default submit action. so your page will still submit rather than executing JS.

    You’ll need to do a couple things:

    1. Prevent the default action (ie the submission)
    2. Serialize your form data and submit it via ajax.

    So in code it would look something like this:

    $(document).ready(function() { 
        //Cache DOM reference
        var form = $("#contactus");
    
        form.submit(function(event) {
            //Prevent the form from regular (non-js) submission
            event.preventDefault();
    
            //Serialize your data, using jQuery to make it easer
            var data = form.serialize();
    
            //Submit via ajax
            $.post(
              form.attr('action'),
              data,
              function(response) {
                //You should modify your PHP to return a success or error code, then
                //handle appropriately here - eg if (response === 'success") {...
              }    
            );
    
         });
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using code from this page http://code.google.com/apis/contacts/docs/1.0/developers_guide_js.html to get list of gmail contacts. Actually
In a nutshell on page1.php I have a calculator that consists of an HTML
I'm saving contacts (email, mobile phone, ICQ, AIM etc.) for people like this: class
I've got a query that looks a bit like this: select records.id, contacts.name +
I m creating a Website as Static HTML pages. In that only in one
An application I'm working with has the page structure setup such so that when
So, we've got PHP 5.3.2 installed on a Windows 2008 R2 Server. PHP.ini file
I have a tell a friend pop up email form that allows users to
I wanted to make a dynamic navigation bar that could identify the current page
I am looking for fast methods/ways I can redirect a HTML page to another

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.