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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:58:59+00:00 2026-05-23T06:58:59+00:00

Im a bit of a newbie. Im trying to post some data I have

  • 0

Im a bit of a newbie.

Im trying to post some data I have in a JavaScript variable to my server.

Iv looked around and from what I gather I need to put it in as part of a form? is there anyway to hide this form box?

Do I place this information in the value section of the form?

Eg.

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <title>Namespace</title>

    <script type="text/javascript" charset="utf-8">

        functionAddPostData(){

        var name = "Christopher";
        var last = "Bar";

       var formInfo = document.forms['info'];

       name = formInfo.elements["first"].innerHTML;
        last = formInfo.elements["surname"].innerHTML;

      }</script>

     </head>
     <body>
     <form action="script.php" method="post" allign="bottom">
        <label for="info"> 
            <input type="text" name="first" value="" size ="40" />
        <input type="text" name="surname" value="" size ="60" />
            <input type= "submit" name="submitted" value="info" allign="middle"/>

     </form>  
     </body>
     </html>

This is my best guess? Am I heading in the right direction? Is there a way to hide the form boxes?

  • 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-23T06:59:00+00:00Added an answer on May 23, 2026 at 6:59 am

    Use hidden fields to post the data to server if you dont want to show the textbox in the UI.

    <input type="hidden" name="first" value="" size ="40" />
    

    You should set the onSubmit of form to functionAddPostData which will get called when you submit the form. Also the form should have a name atttibute since you are trying to access it by name.

    The form element values should be set as below

    var formInfo = document.forms['info'];
    
    formInfo.first.value = name;
    formInfo.surname.value = last;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a bit of a newbie to XPath, so I need some help figuring
I'm a bit of a NuGet newbie and have come from the Maven world.
Sorry i am a bit of a newbie. I have a form with some
I'm a bit of a PHP newbie, but I'm trying to put some include
A bit of a newbie question on rails associations. I have a Bug model,
Ok bit of a newbie type question. I want to use Core Data, together
this is a bit of a newbie question but hoping I can get some
Bit of a javascript newbie so not sure if this question is easy or
I'm a bit of a NHibernate newbie and Im taking on some code written
Bit of a JavaScript newbie here - I am firing this basic bit of

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.