PDA

View Full Version : Insert into an array list



apj
11-01-2009, 06:39 AM
I am currently working on a schedule function. I do not have a database. So i am trying to insert the data from the form into an array list. But i do not have any idea on how to insert the data into the array list. Is there any way to do this ? Thanks :)

jscheuer1
11-01-2009, 07:19 AM
Javascript is no substitute for a database. That said, you can easily create an array:


var a = [];

Then you can insert things into it:


a.push('Hey There!');

The problem (if you are looking at this as a database) is that after the page is unloaded, a will no longer be defined, and the 'Hey There' that was pushed into it will be lost. On a limited basis, some stuff like this can be preserved in a javascript client side cookie, but those may be disabled or erased easily by users, sometimes inadvertently. This is in contrast to a server side database which can only be altered by the user as you allow.

forum_amnesiac
11-01-2009, 09:58 AM
If you have a need to preserve the input, without using a database, then you could try doing this using a 'flat' file, eg csv