Log in

View Full Version : If I could just do SOMETHING...



vb2java
10-20-2011, 04:48 PM
Hello,

I have Windows Server 2003 running IIS 6.0. Currently I am sticking with Classic ASP.

I am trying to get my feet wet and create my first guestbook. I want to start with a text file as my data source and then move up to using Excel. I have experience with using vbscript to work with textfiles and Excel workbooks.

I am interested in someone's logical understanding of the larger scope. If it could be put broadly first, then funneled down with a couple lines of code, I have the VBscript experience to take it from there. Let's just work with a very simple form with one textbox called "First Name: ".

SAMPLE EXPLANATION

Ok here is what I mean by the broad scope: To explain the textbox "First Name: " it would be good to understand that "First Name: " is just text that is to be written in the <body> of the page. We have not defined the actual textbox. So the entire line will look like this:

<body> <!-- First we will create a line break followed by a space so our content is not all jammed up in the corner and against the far left side. -->

</br>
&nbsp; First Name: <input type="text" name="firstname" />

</body>

Of course I could go in to explaining the whole thing but you get the idea. I will give a clear picture of what I am not understaning in a moment. First, let's get some XHTML 1.0 code to get started. Let's call this the registration page.



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>Registration Page</title>
</head>
<body>

</br> <!-- I AM CONCERNED WITH HOW TO CUMMUNICATE WITH ANOTHER ASP PAGE -->

&nbsp; <form action="register.asp" method="Post">
&nbsp; First Name: <input type="text" name="firstname" /><br />
&nbsp; <input type="submit" value="Submit" /> &nbsp; <input type="reset" />
&nbsp; </form>

</body>
</html>

This is basically it. I mean I have a bunch of other textboxes for gathering different information, but no use have a whole bunch of them if I can't even do anything with one! Lol!

You see, I am filled with too many questions a one time. Everything I come accross (tutorials wise) uses SQL server as the data source. I am not using SQL server (although I will in the future), I am using text files and then Excel after getting comfortable with the text file method. I am trying to gain experiece not debate the best database method to use. Sorry, just have to throw that in here due to previous forums experiences.

The following code is in register.asp and does not work:

<%
Option Explicit
Dim firstname
firstname = Request.Form("firstname")
If firstname<>"" Then Response.Write("Hello" & firstname & "!")
%>

THE LOGIC OF IT ALL

Please consider the scope of what I am trying to do.

In order to become a member, the user must first register. Let's just use a four field registration form: First Name: , Last Name: , Username: , and Password: . When the user fills out the XHTML form, ASP then validates and processes the data. I am trying to process the data from a separate asp file so I can reuse the code somewhere else, if need be. I figure if someone could help me process and validate just one textbox, I should be able to hit the ground running.

The structure would be as follows:

RegistrationPage.asp ' Page being viewed by the user
register.asp ' Code for processing data
guestbook.txt ' Initial Data source before changing to Excel

So finally, I ask the questions:

First, is the above file structure able to be used in the way that I indend?
How can I use ASP to process a form using the above file structure?
What code needs to be included in RegistrationPage.asp?
What code needs to be included in register.asp?
Should we use the FileSystemObject or ADO to save the data in "guestbook.txt"?

Dee_Veloper
12-23-2011, 08:39 PM
Try this guest book example

http://www.aspkey.net/aspkey/_articles/asp/showarticle.asp?id=91