User Guide
532 CFML Language Reference
</CFIF>
</CFIF>
<P>
This example uses the StructNew function to create a structure
that supplies employee information. The data structure is called
"employee" and its fields are filled with the contents of the
following form. After you have entered employee information into the
structure, the example uses the <b>StructKeyArray</b> function to copy
all of the keys from the structure into an array.
</P>
<hr size="2" color="#0000A0">
<FORM ACTION="structkeyarray.cfm" METHOD="post">
<table cellspacing="2" cellpadding="2" border="0">
<tr>
<td>First Name:</td>
<td><INPUT NAME="firstname" TYPE="text" VALUE="" hspace="30"
maxlength="30"></td>
</tr>
<tr>
<td>Last Name:</td>
<td><INPUT NAME="lastname" TYPE="text" VALUE="" hspace="30"
maxlength="30"></td>
</tr>
<tr>
<td>EMail</td>
<td><INPUT NAME="email" TYPE="text" VALUE="" hspace="30"
maxlength="30"></td>
</tr>
<tr>
<td>Phone:</td>
<td><INPUT NAME="phone" TYPE="text" VALUE="" hspace="20"
maxlength="20"></td>
</tr>
<tr>
<td>Company:</td>
<td><INPUT NAME="company" TYPE="text" VALUE="" hspace="30"
maxlength="30"></td>
</tr>
<tr>
<td><INPUT TYPE="submit" NAME="submit" VALUE="OK"></td>
<td><b>After you submit the FORM, scroll down to see the array.</b>
</td>
</tr>
</table>
</FORM>
<CFIF NOT StructISEmpty(employee)>
<hr size="2" color="#0000A0">
<CFSET keysToStruct = StructKeyArray(employee)>
<CFLOOP index="i" from="1" to="#ArrayLen(keysToStruct)#">
<P><CFOUTPUT>Key#i# is #keysToStruct[i]#</CFOUTPUT></P>