ASP Code
  Home arrow ASP Code arrow Free input form all done from one Page usi...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP CODE

Free input form all done from one Page using Sub Procedures
By: aspfree
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 2 stars2 stars2 stars2 stars2 stars / 3
    1999-10-11

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


     

    <h2>Please Enter contact information in the form below so we may contact you about advertising.</h2>
    <table border="1" width="100%">
    <tr>
    <td width="18%">Name:</td>
    <td width="82%"><input type="text" name="name" size="40"></td>
    </tr>
    <tr>
    <td width="18%">Email Address:</td>
    <td width="82%"><input type="text" name="emailaddress" size="40"></td>
    </tr>
    <tr>
    <td width="18%">Phone Number:</td>
    <td width="82%"><input type="text" name="phonenumber" size="40"></td>
    </tr>
    <tr>
    <td width="18%">Comments</td>
    <td width="82%">&nbsp;</td>
    </tr>
    <tr>
    <td colspan="2" width="100%"><textarea rows="6" name="comments" cols="58"></textarea></td>
    </tr>
    </table>
    <p>&nbsp;</p>
    <p><input type="submit" value="Submit" name="btnSubmit"><input type="reset" value="Reset"
    name="B2"></p>
    </form>
    </BODY>

    </html>

    <% End Sub %>

    3 of 3 subs that is used in this example  This procedure does the server-side code to insert a record and send an email.  Then it redirects back to the form with one request.querystring variable to notify the Thank you page to be displayed.


    <% Sub DoRecords() %>

    'Note that I'm using an include file for my connection string, sense all server-side processing that needs a database connection is inside this sub that is where I place the connection string.  You could easily put a DSN Entry, DSN-Less entry in here too.


    <!--#include file="conn.asp"-->
    <%
    dim strconn
    dim conn
    dim rs

    set conn = server.createobject("adodb.connection")
    conn.open strconn
    set rs = server.createobject("adodb.recordset")
    rs.open "PutYourTableNameHere", conn, 3, 3
    rs.addnew
    rs("name") = request("name")
    rs("emailaddress") = request("emailaddress")
    rs("phonenumber") = request("phonenumber")
    rs("comments") = request("comments")
    rs("DateSubmitted") = date()
    rs.update
    rs.close
    set rs = nothing
    conn.close
    set conn = nothing

    'Builds the body of the Message
    strBody = "A request for some info about your site" & chr(10) & chr(10) 
    strBody = strBody & "Name: " & request("Name") & chr(10)
    strBody = strBody & "EmailAddress: " & request("Emailaddress") & chr(10)
    strBody = strBody & "PhoneNumber: " & request("PhoneNumber") & chr(10)
    strBody = strBody & "Comments: " & chr(10) & request("comments")


    'Mails a copy of this request to the someone

    set objNewMail = server.CreateObject("CDONTS.NewMail")
    objNewMail.From = "ASPFree.com"
    objNewMail.To = "someone@aspfree.com"
    objNewMail.BCC = "someone@aspfree.com"
    objNewMail.Subject = "A Simple form to collect info"
    objNewMail.Body = strBody
    objNewMail.Send
    set objNewMail = Nothing
    response.redirect "ads.asp?strMessage=Thanks"
    End Sub

    %>
    <% 

    This is where the real logic is done.

    'This If statement displays the Intro Page
    If request("btnSubmit") = "" and request("strMessage") = "" Then
    call IntroPage()
    End If

    This if calls the DoRecords() Sub to process the form values
    If request("btnSubmit") = "Submit" Then
    call DoRecords()
    End If

    This if processes the Thank you page after the form was submitted
    if request("strMessage") <> "" Then
    call Thanks()
    End If

    %>


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More ASP Code Articles
    More By aspfree

     

    IBM® developerWorks developerWorks - FREE Tools!


    NEW! "ebook: Exploring IBM SOA Technology & Practice

    Learn field-tested SOA principles, methodology, technology and implementation from the global SOA market leader - in a new e-book by an IBM SOA expert. Written by IBM Certified SOA Solution Designer Bobby Woolf, "Exploring IBM SOA Technology & Practice" is the ultimate insider's guide to SOA - a PDF e-book packed cover to cover with IBM's specific advice on how to make your SOA implementation a success.
    FREE! Go There Now!


    NEW! Best Practices in Integrated Requirements Management

    Poor Requirements Management capabilities in an Enterprise have been linked to excessive project failures, escalating IT costs, and failure to deliver competitive advantage into the marketplace. Join Brianna M Smith from IBM Rational and learn about how successful organizations align IT and Business stakeholders through collaborative processes and tools for effective requirements management, and how an integrated approach across the IT lifecycle can provide unparalleled visibility and traceability to ensure that project teams are delivering on the business vision by "doing the right things" and "doing things right."
    FREE! Go There Now!


    NEW! BlammoSplat: Build a community Web site of OpenLaszlo animations, Part 3: The community animation

    Learn to enable users to both rate existing animations and to combine existing animations into new snippets. This is the third in a series of three tutorials that chronicle the building of a site that enables collaborative discussion and animation building using Domino and OpenLaszlo.
    FREE! Go There Now!


    NEW! Did you say mainframe? e-kit

    Learn how you can extend modern application lifecycle management to IBM System z through the IBM Rational Software Delivery Platform (SDP). The Did you say mainframe? e-kit includes podcasts, webcasts, tutorials, white and red papers, demos, and articles designed to help ease the challenges of modernizing your enterprise. This complimentary kit for mainframe developers is a practical, how-to guide for making the most of an existing development environment, including the skills and infrastructure already in place at an established enterprise.
    FREE! Go There Now!


    NEW! Improve your build process with IBM Rational Build Forge, Part 1: Create a continuous build and integration environment

    Learn how to implement a build management system that uses and extends your existing automation technologies. This tutorial shows, step-by-step, how to install and configure IBM Rational Build Forge to manage builds for Jakarta Tomcat from source code.
    FREE! Go There Now!


    NEW! Krugle, developerWorks, and code search

    Ken Krugler, co-founder of code search company Krugle, and Laura Merling, vice president of Marketing and Business Development for Krugle, join to talk about the ins and outs of code search and what it means as a new feature for developerWorks users.
    FREE! Go There Now!


    NEW! Rational Talks to You: Manage RUP-based CMMI initiatives

    Join this Rational Talks to You teleconference on December 4 at 1:00 pm ET to discuss how Rational Method Composer can help meet your compliance objectives. Get your questions answered!
    FREE! Go There Now!


    NEW! Section 508 of the U.S. Rehabilitation Act: Web accessibility compliance

    Because access to government information continues to be an area of concern for many U.S. citizens with disabilities, the U.S. government enacted Section 508 of the Rehabilitation Act in 2001 to ensure that government agencies create accessible Web content, enabling all citizens to access the information they need. A fully accessible Web site makes Web content accessible to all individuals, including those with disabilities, who may be accessing Web content via a variety of user agents. Common user agents include standard Web browsers, text-only browsers, assistive devices and mobile devices such as cell phones or personal digital assistants (PDAs).
    FREE! Go There Now!


    NEW! Webcast: Accelerating Software Innovation with System z

    Attend this launch webcast with Scott Hebner, Vice President of IBM Rational Marketing and Strategy, where he will overview Rational’s new offerings and programs to help customers accelerate software innovation on System z. He will discuss how these solutions help organizations extend their core business processes toward modern architectures such as SOA and web technologies to deliver business improvements that stand the test of time.
    FREE! Go There Now!


    NEW! Webcast: Calling All Testers! Find Application Vulnerabilities Early in the Development Process Where they are Easier to Fix and Less Risky to your Business

    In this webcast, IBM Rational will discuss the importance of Web application security and will share techniques and best practices to introduce application security testing into current QA processes including: understanding common security vulnerabilities and techniques to integrate security testing with defect tracking and remediation systems in an effort to safeguard sensitive online information.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    ASP CODE ARTICLES

    - ASP Forms
    - ASP: The Beginning
    - Getting Remote Files With ASP Continued
    - Inbox and Outbox Manipulation in ASP
    - Relational DropDownList Using VB.NET
    - Ad Tracking URL Hits
    - Use ViewState to display one record per page...
    - Send Email using ASP.NET formatted in HTML
    - ASP File Explorer
    - ASP/XML Interview questions by Srivatsan Sri...
    - Various methods of setting Date values to a ...
    - Conditional DataGrid Item and using checkbox...
    - Fill .NET Listbox with SQL DataReader
    - Filling Dropdown box using Code-Behinds in C#
    - FLAMES code sample written in .NET What is F...

     
    Application Delivery: Everything You Wanted to Know, but Didn`t Know You Needed to Ask
    A comprehensive guide to examining the topics of Wide-area Data Services and app....

     
    Best Practices: Safe and Secure Hardware Asset Recovery
    Companies increasingly must meet EPA and local requirements for the disposal of ....

     
    Managing SSL Security in Multi-Server Environments
    Read this white paper to learn how to simplify management of your organization's....

     
    Open Source Security Myths
    Open Source Software (OSS) is computer software whose source code is available t....

     
    Power and Cooling Capacity Management for Data Centers
    This paper describes the principles for achieving power and cooling capacity man....

     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT