Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 18th, 2005, 10:16 AM
Authorized User
 
Join Date: Mar 2005
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dynamic reading from Querystring

Hi!

I'd like to add a function to my web page which gives the user the possibility to delete records from the database.

Therefore, I'd like to have a checkbox next to every record and a "Delete selected records" button in the end of the list.

Every record has a unique identifyer field, and I'd like to pass those values in a form to a ASP page that deletes those records in the database where the unique identifyer is equal to the Request.Form values.

If I call the checkboxes Id234, Id235, ... , Id454, is there a way to extract the identifyer value behind the leading Id chars?

Example, if I have selected three records with identifyers 236, 332 and 401:

Request.Form() = "Id236=on&Id332=on&Id401=on"

Or is there a more simple solution to this problem?

 
Old May 19th, 2005, 01:08 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

One approach to this problem is to give same name to all the checkboxes, and value will be 236, 332 etc. If user checks any of the checkboxes, then you will get an array in request.form("checkbox_name")

you can access these values with
Request.Form("checkbox_name").Item(0) or you can split the comma separated values.



Om Prakash
 
Old May 19th, 2005, 02:39 AM
Authorized User
 
Join Date: Mar 2005
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Correct me if I'm wrong, but isn't the only values on a checkbox "on" or nothing?

 
Old May 19th, 2005, 10:04 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

you will get value as "on" when u don't specify the value in checkbox.

<input type=checkbox name=c1 value="test">
<input type=checkbox name=c2>

<%
Response.Write "c1=" & request("c1") - gives "test"
Response.Write "c2=" & request("c2") - gives "on"
%>

Om Prakash
 
Old May 19th, 2005, 10:30 AM
Authorized User
 
Join Date: Mar 2005
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Okey! Thanx Om!

 
Old May 21st, 2005, 10:08 AM
Friend of Wrox
 
Join Date: May 2005
Posts: 189
Thanks: 0
Thanked 0 Times in 0 Posts
Default

you'll need to set up some query's to comunikate with your db. Is it these query's you are asking about?

1. Ekstract the fields you want from the db
2. present the these records in a form, a page ...
3. Include a button or a checkbox whatever next to each post
4. Finger in the script which deletes the records in the db
5. and that is it!!






Similar Threads
Thread Thread Starter Forum Replies Last Post
using querystring melkin Classic ASP Basics 7 April 1st, 2008 09:07 AM
help writing dynamic form data to dynamic table ublend SQL Server ASP 1 June 1st, 2007 08:09 AM
help writing dynamic form data to dynamic table ublend Classic ASP Professional 1 June 1st, 2007 08:08 AM
Querystring or not? myself Classic ASP Basics 4 July 4th, 2006 09:01 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.