PWS gives you the ability to get information from visitors to your Web site, and to respond to your visitors on the basis of the information they give you. This procedure is designed to help you customize a simple interactive form to meet your information-gathering needs. The procedure assumes that you do not know HTML, or a scripting or programming language, and it does not teach you these. Instead, you will use cut-and-paste and search-and-replace techniques to construct a working form that sends data to a sample database included with PWS. Because the database is created in Microsoft Access, you can view and edit the gathered data either by opening the database in Access, or by using another script, which is provided in Viewing A Database in a Browser.
To create the fileTip If the heading seems too large for your page, reduce the height of the letters by changing the 1 in the opening and closing <h1></h1> tags to a 2.
Tip To prevent Notepad from adding .txt to the file name, select All Files(*.*) as the Save as Type option.
You are now ready to paste in the sections of script that display various text boxes, check boxes, and radio buttons. You can add the individual elements in any order you choose. You are not required to use all the elements in your page, but each element can only be used once. For instance, First Text Box can only be used once. If you need another text box, you must use either Second Text Box, or one of the memo boxes for the next text box on the page. The following is a list of the form elements available:
Element Name | Element | Description |
---|---|---|
First Text Box | Label: |
These four text boxes can be used for input expected to be less that 255 characters. Use these for items such as names or e-mail addresses. |
Second Text Box | ||
Third Text Box | ||
Fourth Text Box | ||
First Memo Box | Label: |
These two boxes have unlimited length and can be used when content may be large. Use these in places where visitors are invited to leave comments. |
Second Memo Box | ||
First Check Box | Label | These boxes return True if the item is checked and False if the item is not checked. Selecting one of these boxes has no effect on the other box. |
Second Check Box | ||
Radio Buttons | Label: Label: Label: | This element give users a single, mutually exclusive choice of three options. If the user selects the first option, 1 is returned. If the user selects the second option, 2 is returned. If the user selects the third option, 3 is returned. |
To add the fields to your form
Tip When you copy, if you include the starting and ending comments before and after each section of code, your finished page is much easier to read and edit at a later date. The comments are not displayed on the page when viewed in a browser.
<!-- ===Start First Text Box Element Section=== --> <p> Replace this text with a label or caption for the first text box: </p> <p><input type="Text" name="FirstTextBox"></p> <!-- ===End First Text Box Element Section=== --> <!-- ===Start Second Text Box Element Section=== --> <p> Replace this text with a label or caption for the second text box: </p> <p><input type="Text" name="SecondTextBox"></p> <!-- ===End Second Text Box Element Section=== --> <!-- ===Start Third Text Box Element Section=== --> <p> Replace this text with a label or caption for the third text box: </p> <p><input type="Text" name="ThirdTextBox"></p> <!-- ===End Third Text Box Element Section=== --> <!-- ===Start Fourth Text Box Element Section=== --> <p> Replace this text with a label or caption for the fourth box: </p> <p><input type="Text" name="FourthTextBox"></p> <!-- ===End Fourth Text Box Element Section=== --> <!-- ===Start First Memo Box Element Section=== --> <p> Replace this text with a label or caption for the first memo box: </p> <p><textarea name="FirstMemoBox" rows=6 cols=70></textarea></p> <!-- ===End First Memo Box Element Section=== --> <!-- ===Start Second Memo Box Element Section=== --> <p> Replace this text with a label or caption for the second memo box: </p> <p><textarea name="SecondMemoBox" rows=6 cols=70></textarea></p> <!-- ===End Second Memo Box Element Section=== --> <!-- ===Start First Check Box Element Section=== --> <p><input type="CHECKBOX" name="FirstCheckBox" value="true" > Replace this text with a label or caption for the first check box: </p> <!-- ===End First Check Box Element Section=== --> <!-- ===Start Second Check Box Element Section=== --> <p><input type="CHECKBOX" name="SecondCheckBox" value="true" > Replace this text with a label or caption for the second check box: </p> <!-- ===End Second Check Box Element Section=== --> <!-- ===Start Radio Buttons Element Section=== --> <p><input name="RadioButtons" type="RADIO" value="1"> Replace this text with a label or caption for the first option. <br> <input name="RadioButtons" type="RADIO" value="2"> Replace this text with a label or caption for the second option. <br> <input name="RadioButtons" type="RADIO" value="3"> Replace this text with a label or caption for the third option. </p> <!-- ===End Radio Buttons Element Section=== -->
Now that the form is complete, you must edit the statements that insert data into the database so they match the fields in your form. The Sampform.asp file contains references to all the available fields and the input they receive. You must remove the references for elements you did not include in your form. The following table displays the element name and the corresponding field name.
Element | Field Name |
---|---|
First Text Box | TB1 |
Second Text Box | TB2 |
Third Text Box | TB3 |
Fourth Text Box | TB4 |
First Memo Box | MB1 |
Second Memo Box | MB2 |
First Check Box | CB1 |
Second Check Box | CB2 |
Radio Buttons | RB |
Note Regardless of the order of the elements on your page, do not change the order of the field names in the statement.
'Second Text Box Parameter Statement
'set objparam=cm.createparameter(, 200, , 255, strTB2)
'cm.parameters.append objparam
To add a link to the form on your home page
Related Topics