473,785 Members | 2,767 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Putting form values in array

132 New Member
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 1213
RamananKalirajan
608 Contributor
Hi dude, dont do that in that way rather do like this

[HTML]<script language="javas cript">
var myArray=[];
function assign()
{
myArray.push(do cument.getEleme ntById('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
5487
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 type="text" name="name" size="10"> <input type="text" name="url" size="40"> </form>
5
3798
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 displays these fileds and values in different ways so am creating one page and parsing variables to it. The problem appears to be in trying to write the values to a text file. The page displays the field names correctly but when I submit the form...
9
30122
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) { $_SESSION = array(); } ?> <form enctype="multipart/form-data" name="company_info" method="post" action="add_pic.php">
4
2261
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 complex, and I don't want to have to mess around with formatting a page using HTML within php. So basically the "action" of the HTML page sends the form to "ProcReg.php". This is the code: <?php /* Script name: ProcReg.php
2
7053
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, input box for units of service, description of the service and each row has its own dropdown list of unit fees that apply. Each dynamically created row will return 3 values fee1_choice, fee1_unit and fee1_money. Note The above informaton is...
26
2815
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 they press next the form generates "How old are you?" 5 times on the page. The customer will answer all 5 questions then press next. Finally, all the local variables get dynamically created and written to a database. I have already taken care of...
1
2825
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 enter input. I need to take this user input and put it back into the database. What would be the best method to do this. I can't use a normal post because the name of the text box is the same for each table row. I've heard that posting the...
0
2197
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 CSV file without any issues only if all the fields are not null. If any field is blank, it moves the values to the left and displays the value under invalid column. Example is shown below: A part of CSV file. I am reading the first row as...
2
1509
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 so it can accept multiple values that I can iterate through? Don't need the iteration part (yet). function setField($type, $name, $value, $style, $label, $validationparameter) {
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10152
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10092
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7500
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3650
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2880
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.