473,387 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Putting form values in array

132 100+
Hi,

In one of my scripts I'm having difficulties adding fromvalues to an array.

For testing purposes I made an array like this:
Expand|Select|Wrap|Line Numbers
  1. var mijnlotto1 = [19,23,27,32,34,41];
  2.  
This way my script works.
However I want to fill in the array dynamically. So I want to create the array called mijnlotto1 from input boxes that are on my page. So I did:
Expand|Select|Wrap|Line Numbers
  1. var mijnlotto1 = new Array();
  2. mijnlotto1[0]=document.combinatie1.nr1.value;
  3. mijnlotto1[1]=document.combinatie1.nr2.value;
  4. mijnlotto1[2]=document.combinatie1.nr3.value;
  5. mijnlotto1[3]=document.combinatie1.nr4.value;
  6. mijnlotto1[4]=document.combinatie1.nr5.value;
  7. mijnlotto1[5]=document.combinatie1.nr6.value;
  8.  
where combinatie1 is the name of the form and nr1 to nr6 are the names of the input boxes. However using this method the script won't work.

The array mijnlotto1 is being used to compare to another array. So I'm guessing the format of mijnlotto1 is not correct. However I'm not sure what the right format would be.

The other array is fixed and is created like this:
Expand|Select|Wrap|Line Numbers
  1. lotto[0] = new lottohistory('4-2-1978', '6', '17', '30', '31', '35', '37', '15', '460171.2', '0', '0', '18', '1701', '35206', '1.24');
Any help would be appreciated.
Jul 28 '08 #1
1 1195
RamananKalirajan
608 512MB
Hi dude, dont do that in that way rather do like this

[HTML]<script language="javascript">
var myArray=[];
function assign()
{
myArray.push(document.getElementById('Ele1').value );
}
</script>[/HTML]

Here Ele1 is the id given to your text box

Ex. <input type="text" id="Ele1">

Do like this surely your code will work;

Regards
Ramanan Kalirajan
Jul 28 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Yang Li Ke | last post by:
Hi I know that there is a meta tag function to get all meta tags from a url. I am searching for a similar function that would get all values of a form. something like : <form> <input...
5
by: Paul C-T | last post by:
Hi, Am I trying to be too clever here? I am trying to write a PHP page to enable me to enter values into a form then write those values to a text file. I want to use the form & table that...
9
by: Ken | last post by:
How can I reset the initial form variables that are set with session statements when clicking on a button? I tried this but the function was not called: <?PHP function reset_form($none) {...
4
by: Cerebral Believer | last post by:
Hi I need help! Forgive me I am a PHP newbie. I have a small script that enables me to send a form from an HTML page. I want to use the HTML formatted form because the design of my website is...
2
by: assgar | last post by:
Hi Developemnt on win2003 server. Final server will be linux Apache,Mysql and PHP is being used. I use 2 scripts(form and process). The form displays multiple dynamic rows with chechboxs,...
26
by: Jerim79 | last post by:
I need to create a form that takes a number that the user enters, and duplicates a question the number of times the user entered. For instance, if the customer enters 5 on the first page, when...
1
by: Muchach | last post by:
Hello, Ok so what I've got going on is a form that is populated by pulling info from database then using php do{} to create elements in form. I have a text box in each table row for the user to...
0
by: Anish G | last post by:
Hi, I have an issue with reading CSV files. I am to reading CSV file and putting it in a Datatable in C#. I am using a regular expression to read the values. Below is the code. Now, it reads...
2
by: Phil Latio | last post by:
Still having fun trying to build the perfect form and validation classes and wondered if anyone can help on the following. In the following function, how can I make $validationparameters an array...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.