StructNew

説明

構造体を作成します。

戻り値

構造体

カテゴリ

構造体関数

関数のシンタックス

StructNew()

関連項目

構造体関数、『ColdFusion アプリケーションの開発』のStructure functions

パラメータ

なし

<!--- Shows StructNew. Calls CF_ADDEMPLOYEE, which uses the | 
    addemployee.cfm file to add employee record to database. ---> 
<h1>Add New Employees</h1> 
<cfparam name = "FORM.firstname" default = ""> 
<cfparam name = "FORM.lastname" default = ""> 
<cfparam name = "FORM.email" default = ""> 
<cfparam name = "FORM.phone" default = ""> 
<cfparam name = "FORM.department" default = "">  
<cfif FORM.firstname EQ ""> 
    <p>Please fill out the form. 
<cfelse> 
    <cfoutput> 
<cfscript> 
    employee = StructNew(); 
    StructInsert(employee, "firstname", FORM.firstname); 
    StructInsert(employee, "lastname", FORM.lastname); 
    StructInsert(employee, "email", FORM.email); 
    StructInsert(employee, "phone", FORM.phone); 
    StructInsert(employee, "department", FORM.department); 
    </cfscript> 
    <p>First name is #StructFind(employee, "firstname")# 
    <p>Last name is #StructFind(employee, "lastname")# 
    <p>EMail is #StructFind(employee, "email")# 
    <p>Phone is #StructFind(employee, "phone")# 
    <p>Department is #StructFind(employee, "department")# 
    </cfoutput> 
<!--- Call the custom tag that adds employees ---> 
    <CF_ADDEMPLOYEE EMPINFO = "#employee#"> 
</cfif>