Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Other Programming > VBScript
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VBScript For questions and discussions related to VBScript.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VBScript section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 19th, 2003, 12:55 PM
Authorized User
 
Join Date: Oct 2003
Location: , , .
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default Store and display data using asp

Hi All,

How can I store input form data and display in a table using asp page.

Thanks...



Reply With Quote
  #2 (permalink)  
Old November 19th, 2003, 01:24 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

Depends on the method attribute of the form. If its GET, then you need to look at
Code:
Request.QueryString("whateverTheFieldIsCalled")
to get its value.

If the form is set to POST, the data will be in
Code:
Request.Form("whateverTheFieldIsCalled")
To write out data just use
Code:
Response.Write Request.Form("whateverTheFieldIsCalled")
As for storing the data, the usual place is a database for which you use ADO.

That's about all I can give you without more detail of what you want to do.

hth
Phil
Reply With Quote
  #3 (permalink)  
Old November 19th, 2003, 01:49 PM
Authorized User
 
Join Date: Oct 2003
Location: , , .
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am using post method and I would like to store and display the data without using database. I was wondering if there was any way that I could display for every input entry from form.

Thanks...

Reply With Quote
  #4 (permalink)  
Old November 19th, 2003, 01:56 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Yeah, there is a way to do that. The following code will loop through the entire form collection (when the forms' method is Post) and writes out the name and thee value of each HTML control on the form.
Code:
Dim anItem
Dim myLoop
With Response
    .Write("<h2>Form Collection</h2>")
    For Each anItem in Request.Form
        For myLoop = 1 to Request.Form(anItem).Count
            .Write("<strong>" & anItem & "</strong> = " & Request.Form(anItem)(myLoop) & "<br />")
        Next 
    Next
End with
You can use more or less the same code for the QueryString collection by changing Form to QueryString.


Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #5 (permalink)  
Old November 19th, 2003, 04:30 PM
Authorized User
 
Join Date: Oct 2003
Location: , , .
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar,
When I submitted the form second time I am overwriting the stored data. I would like to keep both stored data and second input data coming from form.

Is there any way, I can do that...

Thanks,

Reply With Quote
  #6 (permalink)  
Old November 19th, 2003, 07:36 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Well, if you want to do that, you'll need some way to save state. The Web is stateless by design. this means that as soon as you have requested a page and received the response, the Web server forgets about you.

For static pages, this is not a problem but it is for pages containing forms and other data.

To save state (the information from the page, in your case), you have a couple of options:

1. Use hidden form fields.
Simply append each new value as a hidden form field

2. Use Cookies
Add your form values to the Cookies collection

3. Use a database
You can store each submitted form in the database. Hoop up a User ID to the database record, so you can see what user submitted what data.

4. Use a text file
Same as the database, but uses a text file instead (only applicable for small sites)

5. Use sessions
You can use ASP Session to store information. This solution doesn't scale well (you can't use it in a web farm (multiple Web servers), so it mostly appropriate for small to medium sized Internet and Intranet sites.

What exactly are you trying to accomplish? Can you elaborate a bit about your current ideas. Not every solution is applicable in every scenario.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
unable to display stored data in textbox(asp.net) Abhinav_jain_mca ADO.NET 6 August 4th, 2004 07:45 AM
unable to display stored data(asp.net) Abhinav_jain_mca ADO.NET 3 August 3rd, 2004 03:33 AM
asp & text files as data store? raa BOOK: Beginning ASP 3.0 1 November 20th, 2003 06:17 AM
Store and display data using asp erin Javascript How-To 1 November 19th, 2003 01:14 PM
display data from cube in ASP pkgal79 Classic ASP Databases 0 August 22nd, 2003 02:54 AM



All times are GMT -4. The time now is 08:11 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.