home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 February / CHIPCD_02_2002.iso / Internet / Macromedia ColdFusion Server 5 / coldfusion-50-win-us.exe / data1.cab / Examples / CFDOCS / snippets / writeoutput.cfm < prev    next >
Encoding:
Text File  |  2001-06-13  |  2.0 KB  |  64 lines

  1. <!--- This example shows how to use the WriteOutput
  2.       function. It calls the CF_ADDEMPLOYEE custom tag,
  3.       which uses the addemployee.cfm file. --->
  4. <html>
  5. <head>
  6. <title>WriteOutput Function</title>
  7. </head>
  8.  
  9. <BASEFONT FACE="Arial, Helvetica" SIZE=2>
  10. <BODY  bgcolor="#FFFFD5">
  11. <H1>WriteOutput Function</h1>
  12. <h3>Add New Employees</h3>
  13. <!--- Establish parms for first time through  --->
  14. <CFPARAM name="FORM.firstname" default="">
  15. <CFPARAM name="FORM.lastname" default="">
  16. <CFPARAM name="FORM.email" default="">
  17. <CFPARAM name="FORM.phone" default="">
  18. <CFPARAM name="FORM.department" default=""> 
  19.  
  20. <CFIF #FORM.firstname# EQ "">
  21.  <P>Please fill out the form.
  22. <CFELSE>
  23.   <CFOUTPUT>
  24.    <CFSCRIPT>
  25.      employee=StructNew();
  26.      StructInsert(employee, "firstname", FORM.firstname);
  27.      StructInsert(employee, "lastname", FORM.lastname);
  28.      StructInsert(employee, "email", FORM.email);
  29.      StructInsert(employee, "phone", FORM.phone);
  30.      StructInsert(employee, "department", FORM.department);
  31.      WriteOutput("<HR>");
  32.      WriteOutput("About to add " & FORM.firstname & " " & FORM.lastname);
  33.   </CFSCRIPT> 
  34.  
  35.   <P>First name is #StructFind(employee, "firstname")#</p>
  36.   <P>Last name is #StructFind(employee, "lastname")#</p>
  37.   <P>EMail is #StructFind(employee, "email")#</p>
  38.   <P>Phone is #StructFind(employee, "phone")#</p>
  39.   <P>Department is #StructFind(employee, "department")#</p>
  40.   </cfoutput>
  41.  
  42.   <!--- Call the custom tag that adds employees --->
  43.   <CF_ADDEMPLOYEE EMPINFO="#employee#">
  44. </cfif>
  45.  
  46. <hr>
  47. <FORM action="writeoutput.cfm" method="post">
  48. <P>First Name: 
  49. <INPUT name="firstname" type="text" hspace="30" maxlength="30">
  50. <P>Last Name: 
  51. <INPUT name="lastname" type="text" hspace="30" maxlength="30">
  52. <P>EMail: 
  53. <INPUT name="email" type="text" hspace="30" maxlength="30">
  54. <P>Phone: 
  55. <INPUT name="phone" type="text" hspace="20" maxlength="20">
  56. <P>Department: 
  57. <INPUT name="department" type="text" hspace="30" maxlength="30">
  58. <P>
  59. <input type="submit" value="OK">
  60. </FORM>
  61.  
  62. </body>
  63. </html>
  64.