navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

Sending checkbox to another page

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Sending checkbox to another page
Page: [1]
 
wizard_oz

 

Posts: 140
Joined: 9/3/2004
From: Ga,USA
Status: offline

 
Sending checkbox to another page - 1/22/2006 9:04:22   
Hi, I would like to send a some checkboxs to another page
I have some data and it works fine but what should I write in the request.form (the other page)
while not rs2.EOF
%>
	<TR>
		<TD><INPUT type="checkbox" id=" " name=<%=rs2("Software")%>></TD>
		<TD><%=rs2("Software")%></TD>
	</TR>
<%
	rs2.MoveNext
	wend


thanks, Elen
BeTheBall

 

Posts: 6354
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Sending checkbox to another page - 1/22/2006 11:05:35   
Checkboxes are a little different than other form fields in that nothing is sent unless the box is checked. You must assign a value attribute to the checkbox and whatever that value is, is what will go to the next page, database, etc.

Here are a couple of examples.

Suppose you are selling t-shirts and you have several checkboxes for the color, a box named red, a box named blue and a box named green. The value of each checkbox is True. If the user checks each box, then you have three form field values of true that are sent to the next step.

The other example is almost the same except instead of the boxes being named, red, blue and green, they are all named color and instead of the values being True, the value of one is red, another blue and the last green. If again the user checks all three boxes, what is sent to the next page is a comma-delimited string that looks like this:

red,blue,green

I suspect this may not directly answer your question, but may give you some insight into how checkboxes behave and help you do what you need. If not, feel free to clarify your needs.

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to wizard_oz)
wizard_oz

 

Posts: 140
Joined: 9/3/2004
From: Ga,USA
Status: offline

 
RE: Sending checkbox to another page - 1/22/2006 16:02:39   
I see what you mean.But I can't give the fields a certien name because I don't know how many fields I have....
I was thinking of your second example, but in your example, how do I read the variables in my other page? Do your have any other suggestion for me how do send some variable to another page?


(in reply to BeTheBall)
Spooky

 

Posts: 26599
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Sending checkbox to another page - 1/22/2006 16:30:16   
The way you are sending them (from your example) is almost correct.
You need a name and a value
eg :
<INPUT type="checkbox" name="software" value="<%=rs2("Software")%>">

Ideally, the rs would be a numeric output representing the software.
eg :
1 = Windows
2 = Linux
3 = Apple

So - if the user selects all, the output of request.form("software") would be "1,2,3"

Now you have a comma delimited array which can be split() or used in the processing page





_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to wizard_oz)
wizard_oz

 

Posts: 140
Joined: 9/3/2004
From: Ga,USA
Status: offline

 
RE: Sending checkbox to another page - 1/23/2006 6:51:33   
Thanks,what I get at the other page is "on,on,on,on......" ,But I do I know which one of the "on" belong to Windows? Linux? (in your example)

(in reply to Spooky)
Spooky

 

Posts: 26599
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Sending checkbox to another page - 1/23/2006 13:49:18   
My assumption is - <%=rs2("Software")%> would be a different value for any saved items.
What is the value saved in the database and how are they stored?

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to wizard_oz)
wizard_oz

 

Posts: 140
Joined: 9/3/2004
From: Ga,USA
Status: offline

 
RE: Sending checkbox to another page - 1/23/2006 16:36:33   
The Values are 2 columns 1 is the ID and the second is the software name like Windows,Office,linux etc.

(in reply to Spooky)
wizard_oz

 

Posts: 140
Joined: 9/3/2004
From: Ga,USA
Status: offline

 
RE: Sending checkbox to another page - 1/24/2006 12:52:25   
Can Someone help me please.
Can Someone send me an example of code that use "checkbox", I need to transfer the checkboxes that I marked to another page
I don't have any idea how to do it......


(in reply to wizard_oz)
Spooky

 

Posts: 26599
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Sending checkbox to another page - 1/24/2006 14:42:39   
Your code should be something like this : (assuming ID is the name of the auto column
		<TD><INPUT type="checkbox" id=" " name=software value=<%=rs2("ID")%>></TD>
		<TD><%=rs2("Software")%></TD>


Its probably passing "on" if you dont have a valid code for the checkboxes.
That can be checked by viewing the source in your browser for that page

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to wizard_oz)
wizard_oz

 

Posts: 140
Joined: 9/3/2004
From: Ga,USA
Status: offline

 
RE: Sending checkbox to another page - 1/25/2006 1:20:44   
Thanks, But how should I create the second page (the page I am recieving the data)?
something like: rs=request.form(.........???

(in reply to Spooky)
wizard_oz

 

Posts: 140
Joined: 9/3/2004
From: Ga,USA
Status: offline

 
RE: Sending checkbox to another page - 1/26/2006 7:10:51   
SomeOne......

(in reply to wizard_oz)
Spooky

 

Posts: 26599
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Sending checkbox to another page - 1/26/2006 13:26:03   
We need to confirm what is happening on that second page

What happens when you do :

<%=response.write("software")%>

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to wizard_oz)
wizard_oz

 

Posts: 140
Joined: 9/3/2004
From: Ga,USA
Status: offline

 
RE: Sending checkbox to another page - 1/29/2006 2:40:50   
The result is the word "software". My problem is , how do I recive the data from the first page? for example, when I am sending a textbox, I give it a name (something like Firstname) and at the second page I am writing Name=request.form("Firstname"), So what Shild I write at the second page for the Checkbox?

(in reply to Spooky)
wizard_oz

 

Posts: 140
Joined: 9/3/2004
From: Ga,USA
Status: offline

 
RE: Sending checkbox to another page - 2/8/2006 1:35:22   
AnyOne??????????????

(in reply to wizard_oz)
jeepless

 

Posts: 213
Joined: 12/20/2003
From: Smack in the middle of USA
Status: offline

 
RE: Sending checkbox to another page - 2/8/2006 10:11:10   
quote:

We need to confirm what is happening on that second page

What happens when you do :

<%=response.write("software")%>


In Spooky's reply three steps up, shouldn't the correct code be:

<%=response.write(software)%> --ie, with quotes removed?

With the quotes, you're telling ASP to write the word "software" and that's exactly what it did but that wasn't the intention. I think he meant for the ASP code to write the value of the variable "software" to see what's being passed to the second page.

Try the corrected code in your second page, then post back what was sent.




_____________________________

The problem with designing a system that's foolproof is that designers underestimate complete fools.

(in reply to wizard_oz)
wizard_oz

 

Posts: 140
Joined: 9/3/2004
From: Ga,USA
Status: offline

 
RE: Sending checkbox to another page - 2/9/2006 8:35:37   
OK, And then what? if I would like to print all the results for this software I should I do it?I can't use loop or something like that

(in reply to jeepless)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> Sending checkbox to another page
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts