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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:09:10+00:00 2026-06-09T09:09:10+00:00

In a simple script that goes through some form fields, gets the user input

  • 0

In a simple script that goes through some form fields, gets the user input and stores it into arrays I ran into a problem.

It works when I do this:

var q1A = parseFloat($('#q1-1').val());
if(isNaN(q1A)) {
    var q1A = 0;
}
parameter.push(' ');
answers.push(q1A);

But now I added another array which, in this case, is supposed to simply store the same q1A variable. But somehow I end up with an “Uncaught TypeError” stating that the variable is undefined! The new code block is:

var q1A = parseFloat($('#q1-1').val());
if(isNaN(q1A)) {
    var q1A = 0;
}
input.push(q1A);
parameter.push(' ');
answers.push(q1A);

I logged the variable in the console and it works just fine, it’s set and has a value. Any idea why it says it’s undefined? The ‘answers’ array stores the value just fine.

Thanks in advance!

EDIT:

Of course I defined the variables. I just didn’t post that part of the code…

var groups = new Array();
var questions = new Array();
var input = new Array();
var parameter = new Array();
var answers = new Array();
var amounts = new Array();
  • 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-09T09:09:11+00:00Added an answer on June 9, 2026 at 9:09 am

    Since it’s possible to push an undefined variable into an array without error, the problem must be that input isn’t defined when you try to call push() on it.

    The usual reason for this problem is that there is another place where the variable input is declared and it’s never initialized in the unexpected place.

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

Sidebar

Related Questions

I have a very simple script that creates a user: <?php include 'mysqlserver.php'; session_start();
I have a simple script that does some search and replace. This is basically
I'm trying to create simple script that subscribes a user to a company calendar.
I'm trying to write a simple script that goes checks the number of lines
I'm trying to write a simple script that goes over a file (name list)
I am trying to write a bash script that goes through a file line
I have pretty simple problem. I have a large file that goes through three
I have this simple script that I'm working on. I must admit, I'm totally
I've written a simple script that displays circles over an image. When you hover
I'm writing a simple script that replaces two images. The first one swaps in

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.