Understanding Array Update
Hi,
I started building an app using the Lynda.com's: Coldfusion: beyond the basics. The "basic" courses were nice to begin with but I quickly found out that they left quiet a bit aside, the "beyond the basics" works, but I found that a lot of the basics where not explained. Now I reached a dead end, I decided to go back to the basics to try to make things slightly clearer.
So far I have:
<!--- if the array does not exist, create it --->
<cfif not isdefined("ar1")>
<cfset ar1 = arraynew(1)>
</cfif>
<!--- Add a form to update the Array --->
<cfif isdefined ("form.ada")>
<cfset index= Arraylen(ar1)>
<cfset temp= arrayappend(ar1, "#form.ada#")>
</cfif>
The rest is to display the array.
Now, by now I suppose that those who bothered to read this far already understood what I did wrong, thing is... I don't
When I enter the data the array is updated, BUT... if I try adding another data it keeps replacing the old one...
I've tried various formats including:
<cfset ar1[index+1]=#form.ada#>
To no avail...
So far I've found that "index" does not reflect the length of the Array, yet the data is displayed both by:
<cfdump var="#Ar1#">
and
<cfloop index="valval" from="1" to="#Arraylen(ar1)#">
...
</cfloop>
I'll be able to handle myself for the rest but this puzzles me.
Thank you
