...

View Full Version : Help In Asp.



Zorro_
05-03-2007, 06:24 PM
Hi!
i am trying to fetch the values from an html page and then inserting them into a database using asp.

i want to know how to fetch the value from a check box and insert in the database..


there are check boxes named:

chk_sunday value:Sunday
chk_mon value :Monday
chk_tue value : Tuesday
chk_wed value :Wednesday
chk_thur value : Thursday
chk_fri value : Friday
chk_sat value : Saturday



<input type="checkbox" name="chk_sun" value="Sunday">
<input type="checkbox" name="chk_mon" value="Monday">
<input type="checkbox" name="chk_tue" value="Tuesday">
<input type="checkbox" name="chk_wed" value="Wednesday">
<input type="checkbox" name="chk_thur" value="Thursday">
<input type="checkbox" name="chk_fri" value="Friday">
<input type="checkbox" name="chk_sat" value="Saturday">

Please help me

Zorro_
05-03-2007, 06:25 PM
i wish to insert only those values for which the check box has been checked

Spudhead
05-04-2007, 03:59 PM
You get a value from a posted form element by using request.form(element_name)

With checkboxes, if the box isn't checked, nothing gets sent through.

So you'd do:

if request.form("chk_sun") = "Sunday" then
' do database stuff
end if

If you're not familiar with this then I'd suggest you start with some simple ASP tutorials - http://www.w3schools.com/asp - because if you don't know how to get values out of a form, you're going to find connecting to a database and running SQL statements against it a whole world of complicated.

degsy
05-11-2007, 04:21 PM
Also there are different methods to get the requested variables into the query.

It depends on how your database is setup.

ghell
05-14-2007, 02:51 AM
Yea if you dont supply a "value" in the form it will be "on" or "off" and if you give them all the same name it will be a comma separated list of "on"s. All these methods can be very useful in different situations.

Zorro_
05-28-2007, 05:59 PM
Thanks a lot guys!
now the form is working...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum