Simple Guestbook
Language(s):ASP
Category(s):FileSystemObject

A simple guestbook to demonstrate using the Scripting.FileSystemObject.

<%@ LANGUAGE="VBSCRIPT" %>
<% Option Explicit %> 

<% 
 'FileScriptingObject Constants 
 Const ForAppending = 8
 Const ForReading = 1
 Const ForWriting = 2
%> 

<!-- 
  Simple Guest Book
  
  Jon Vote, Idioma Software Inc. 
  
  03/2002 

  www.idioma-software.com 

  This program shows how to use the FileSystemObject to 
  append an HTML file from information on a Form.
  
  !! Note !! You must have write permissions on your 
  server to create and append to files. 
  Contact your ISP for further information. 

-->


<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual InterDev 1.0">
<META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
<TITLE>Simple Guestbook</TITLE>
</HEAD>
<BODY>

<Center><H3>Using the FileSystemObject - a Simple Guestbook</H3></Center>
<Center> 
This ASP Example was provided by <A Href="http://www.idioma-software.com">Idioma Software Inc.</A><BR><BR>
</Center>

<%  
 'If the Submit button has not been pressed, 
 'display the form. 
 If Request.Form("AddInformation") = "" Then 
    ShowForm 
 Else 'Submit button was pushed here. 
   'Add the entry only if all fields 
   'have been entered
   If Request.Form("Name") <> "" _ 
     And Request.Form("Comments") <> "" Then 
   AddInformation
   ShowForm 
   Else 
     'Missing field here, show form again. 
     ShowForm 
   End If 
 End If 
%> 

</BODY>
</HTML>

<% 'ShowForm - Display the form here 
Private Sub ShowForm 
%> 
<BR><BR>
<Center><H3>Please enter all of the following information</H3></Center>
<FORM Method=Post>
 <Table Align=Center> 
  <TR>
   <TD>Name:</TD><TD><Input Type=Text Name=Name Size=45 Value="<%=Request.Form("Name")%>"></TD>
  </TR>
  <TR>
   <TD>Comments:</TD><TD><TextArea Name=Comments Cols=40 Rows=5><%=Request.Form("Comments")%>
From: Amitava - 2014-08-10
excellant

This article has been viewed 9218 times.
The examples on this page are presented "as is". They may be used in code as long as credit is given to the original author. Contents of this page may not be reproduced or published in any other manner what so ever without written permission from Idioma Software Inc.