Newbie question: I need an ASP script to store data from a form.

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Newbie question: I need an ASP script to store data from a form.

    I want to have a HTML form that the user fills in and
    clicks submit.
    I then want the data to be stored in an Access datatbase.

    I've loooked and looooked... but I can't find a simple
    script to do the above.

    I'm really new to ASP... so I don't have much clue what i
    should be doing.

    Any help would be appreciated.

    Thanks.


    Jam
    Jammer Guest

  2. Similar Questions and Discussions

    1. how to store Form data?
      hello, I'm revising CMS application that was created 4 years ago and debating with myself on what is the best way to handle form entered...
    2. newbie question - store the variable
      Dear all, Let's say I have two movies, "A" and "B". Movie "A" is a selection menu. After making the selections, user has to press an "ENTER" button...
    3. sorter script [was: Frustrated newbie question]
      Hi drieux: The link that failed for you, worked for me. That link led to this link which had the code. ...
    4. newbie question: how to run a shell script from launcher
      Greetings all: I've install LimeWire util on my machine, I have the following questions: - Is this a good util for file sharing in terms of...
    5. newbie form post question
      Please tell me how I can get the values and items for a form posted using the post method. The posting page is HTML and I won't know what's in it...
  3. #2

    Default Re: Newbie question: I need an ASP script to store data from a form.

    Have you looked in a book such as Beginning Active Server Pages 3.0 from
    Wrox, assuming it's still available? (I don't mean this to be a snide
    remark, really.)

    Ray at work


    "Jammer" <jammer20002@yahoo.co.uk> wrote in message
    news:033301c3788b$b2ea4270$a101280a@phx.gbl...
    > I want to have a HTML form that the user fills in and
    > clicks submit.
    > I then want the data to be stored in an Access datatbase.
    >
    > I've loooked and looooked... but I can't find a simple
    > script to do the above.
    >
    > I'm really new to ASP... so I don't have much clue what i
    > should be doing.
    >
    > Any help would be appreciated.
    >
    > Thanks.
    >
    >
    > Jam

    Ray at Guest

  4. #3

    Default Re: Newbie question: I need an ASP script to store data from a form.

    On Thu, 11 Sep 2003 10:39:49 -0700, "Jammer" <jammer20002@yahoo.co.uk>
    wrote:
    >I want to have a HTML form that the user fills in and
    >clicks submit.
    >I then want the data to be stored in an Access datatbase.
    >
    >I've loooked and looooked... but I can't find a simple
    >script to do the above.
    May be looking for more than you need then. A Google of "ASP Database
    Tutorial" will get you literally hundreds of tutorials on accessing a
    database. Try:

    [url]http://asp-help.com/database/db_tutorial1.asp[/url]

    For the form data, that's a second part:

    [url]http://www.totalasp.co.uk/articles.asp?dismode=article&artid=121[/url]

    Now all you do is combine the two to get the data from the form, and
    save it to a database.

    If you can learn from code, try:

    1) Create an Access database with two fields in a table as follows:

    Table: MemberNames
    Field: FirstName
    Field: LastName

    The Access defaults will work fine here, save the database as
    "Members.mdb" in your web folder.

    2) Create the Form to enter member names as follows, and save in the
    same folder as Form.htm:

    ---------------------------------
    <html>
    <head><title>Member Names Form</title></head>
    <body>
    <H2>Add Member Name</H2>
    <form action="add_new_record.asp" method="post">
    <P>First Name: <input type="text" name="FirstName"></P>
    <P>Last Name: <input type="text" name="LastName"></P>
    <P><input type="submit" value="Submit"><input type="button"
    value="Clear"></P>
    </form>
    </body>
    ---------------------------------
    </html>
    Jeff Cochran Guest

  5. #4

    Default Re: Newbie question: I need an ASP script to store data from a form.

    Dang! Hit "Send" too quick! :)

    Balance of lesson posted below...


    On Thu, 11 Sep 2003 18:23:37 GMT, [email]jcochran.nospam@naplesgov.com[/email] (Jeff
    Cochran) wrote:
    >>I want to have a HTML form that the user fills in and
    >>clicks submit.
    >>I then want the data to be stored in an Access datatbase.
    >>
    >>I've loooked and looooked... but I can't find a simple
    >>script to do the above.
    >
    >May be looking for more than you need then. A Google of "ASP Database
    >Tutorial" will get you literally hundreds of tutorials on accessing a
    >database. Try:
    >
    >[url]http://asp-help.com/database/db_tutorial1.asp[/url]
    >
    >For the form data, that's a second part:
    >
    >[url]http://www.totalasp.co.uk/articles.asp?dismode=article&artid=121[/url]
    >
    >Now all you do is combine the two to get the data from the form, and
    >save it to a database.
    >
    >If you can learn from code, try:
    >
    >1) Create an Access database with two fields in a table as follows:
    >
    >Table: MemberNames
    >Field: FirstName
    >Field: LastName
    >
    >The Access defaults will work fine here, save the database as
    >"Members.mdb" in your web folder.
    >
    >2) Create the Form to enter member names as follows, and save in the
    >same folder as Form.htm:
    >
    >---------------------------------
    ><html>
    ><head><title>Member Names Form</title></head>
    ><body>
    ><H2>Add Member Name</H2>
    ><form action="add_new_record.asp" method="post">
    ><P>First Name: <input type="text" name="FirstName"></P>
    ><P>Last Name: <input type="text" name="LastName"></P>
    ><P><input type="submit" value="Submit"><input type="button"
    >value="Clear"></P>
    ></form>
    ></body>
    >---------------------------------
    ></html>

    3) Create the ASP page to process the form input, as below. Save as
    add_new_record.asp in the same folder:

    ----------------------------------
    <% @LANGUAGE="VBSCRIPT" %>
    <html>
    <head><title>Add New Record</title></head>
    <body>
    <%
    ' Get form data and assign it to variables
    FirstName = request.form("FirstName")
    LastName = request.form("LastName")

    ' Create a query to add a record to the database
    ' This is broken into lines for readability only, could be one line
    SQLstmt = "INSERT INTO MemberNames (FirstName, LastName)"
    SQLstmt = SQLstmt & " VALUES ("
    SQLstmt = SQLstmt & "'" & FirstName & "',"
    SQLstmt = SQLstmt & "'" & LastName & "'"
    SQLstmt = SQLstmt & ")"

    ' Database connection string (can be put in an include for easier
    maintenance)
    dbConnect = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" &
    Server.MapPath("members.mdb") & ";"

    ' Create the connection and open it
    set conn = server.CreateObject("ADODB.Connection")
    conn.Open dbConnect
    ' Execute the SQL Statement
    Set rs = conn.execute(SQLstmt)

    ' Close the connection
    Conn.Close
    set Conn=nothing
    %>

    <P>The record has been added</P>

    </BODY></HTML>
    --------------------------------

    Watch for line wraps on these. There's no error checking, no display
    page, no fancy HTML, you're on your own to figure those out. Aslk
    more questions when you hit snags.

    Oh, and I cut and pasted some of this code from a generic database
    page I use, changed the variable names and scribbled some other code
    in, so this is untested but pretty close. I'm sure others may pick
    out errors or point out better methods.

    Oh, and when you hit your first snag, read this:

    Why do I get database-related 80004005 errors?
    [url]http://www.aspfaq.com/show.asp?id=2009[/url]

    Jeff
    Jeff Cochran Guest

  6. #5

    Default Re: Newbie question: I need an ASP script to store data from a form.

    I use a book called Beginning ASP Databases from Wrox Press. It is my Bible.

    "Jammer" <jammer20002@yahoo.co.uk> wrote in message
    news:033301c3788b$b2ea4270$a101280a@phx.gbl...
    > I want to have a HTML form that the user fills in and
    > clicks submit.
    > I then want the data to be stored in an Access datatbase.
    >
    > I've loooked and looooked... but I can't find a simple
    > script to do the above.
    >
    > I'm really new to ASP... so I don't have much clue what i
    > should be doing.
    >
    > Any help would be appreciated.
    >
    > Thanks.
    >
    >
    > Jam

    GVaught Guest

  7. #6

    Default Re: Newbie question: I need an ASP script to store data from a form.

    THANKS for that.
    That's exactly what I wanted.

    : )
    Jammer Guest

  8. #7

    Default Re: Newbie question: I need an ASP script to store data from a form.

    Hi

    Download and install Codejay from [url]http://www.codejay.com[/url]


    "Jammer" <jammer20002@yahoo.co.uk> wrote in message
    news:033301c3788b$b2ea4270$a101280a@phx.gbl...
    > I want to have a HTML form that the user fills in and
    > clicks submit.
    > I then want the data to be stored in an Access datatbase.
    >
    > I've loooked and looooked... but I can't find a simple
    > script to do the above.
    >
    > I'm really new to ASP... so I don't have much clue what i
    > should be doing.
    >
    > Any help would be appreciated.
    >
    > Thanks.
    >
    >
    > Jam

    Mario b. Guest

  9. #8

    Default Re: Newbie question: I need an ASP script to store data from a form.

    I hate these code generators, if you have to use one write ot yourself if
    you want to aviod alot of pointless, inflexible code in your asp. ;-)


    "Mario b." <mariob@yomin.com> wrote in message
    news:epCzDMReDHA.2324@TK2MSFTNGP12.phx.gbl...
    > Hi
    >
    > Download and install Codejay from [url]http://www.codejay.com[/url]
    >
    >
    > "Jammer" <jammer20002@yahoo.co.uk> wrote in message
    > news:033301c3788b$b2ea4270$a101280a@phx.gbl...
    > > I want to have a HTML form that the user fills in and
    > > clicks submit.
    > > I then want the data to be stored in an Access datatbase.
    > >
    > > I've loooked and looooked... but I can't find a simple
    > > script to do the above.
    > >
    > > I'm really new to ASP... so I don't have much clue what i
    > > should be doing.
    > >
    > > Any help would be appreciated.
    > >
    > > Thanks.
    > >
    > >
    > > Jam
    >
    >

    vladolf Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139