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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:02:06+00:00 2026-05-31T19:02:06+00:00

I wrote this script to for a contact form on my website, everything works

  • 0

I wrote this script to for a contact form on my website, everything works however instead of storing the data in me database all is get is
[object HTMLCollection] c
an anyone tell me what this is?
or what is going wrong? i have had a look on google but i cant find much information on it.

<script type="text/javascript">

    //when the button is clicked



    $(document).ready(function() {

    $("#button").click(function() {



        $('.small').hide();



              var name = $("input#name").val();

            if (name == "") {

          $("span#name").show();

          return false;

        }



              var name = $("input#email").val();

            if (name == "") {

          $("span#email").show();

          return false;

        }



              var name = $("input#subject").val();

            if (name == "") {

          $("span#subject").show();

          return false;

        }



             var name = $("textarea#message").val();

            if (name == "") {

          $("span#message").show();

          return false;

        }







        var dataString = 'name='+ name + '&email=' + email + '&subject=' + subject + '&message=' + message;



            $.ajax({

          type: "POST",

          url: "/scripts/send_message.php",

          data: dataString,



          });

    $("#messagearea").load("console/new_message_profile.php?sent=1");

    });

    });

    </script>
  • 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-31T19:02:08+00:00Added an answer on May 31, 2026 at 7:02 pm

    As @Namit mentioned, you use name as a variable everywhere. Building your string, email, subject and message are uninitialised.

    They should give you an undefined – but no, due to a weird Internet Explorer behaviour (see Is there a spec that the id of elements should be made global variable?) these variables hold DOM elements. As you seem to have multiple elements with the same id (NEVER DO THAT), here a <span> and an <input>, the variables even seem to hold HTMLCollection objects. Which are casted to the string [object HTMLCollection], when you concat them with other strings.

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

Sidebar

Related Questions

I wrote this PHP script to retrieve my form results via email. Everything works
I have a contact form on my website, and everything works like a charm.
I wrote this script to find all files/directories to which $WWWUSER has write permissions.
I wrote this script: $.getJSON('<%=Url.Action("JsonSave","Controler")%>', { id: newRow.Id, personId: newRow.PesronId}, function(data) { $('#grid').trigger('reloadGrid'); //{0}
I wrote this script but it only works if I don't ad class=yes ,
I wrote this script which counts occurrences of particular pattern in a given file.
$(function(){ $('a').each(function(){ var x=this.href; this.href=www.somesitename.com/filter+this.href; }); }); i wrote the above jQuery script to
I am trying to write a python script that takes record data like this
I wrote my custom jquery validation script to validate the fields in the form
I'm writing a script for a lead contact form that needs to send the

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.