Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > ASP E-commerce
|
ASP E-commerce As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP E-commerce 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 September 27th, 2004, 09:45 AM
Registered User
 
Join Date: Sep 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default How can retrieve data from Access by using forms?

Hi,

I am trying to get some values retrieved from an Access database by using the radio and checkboxes form elements. These valued should be summed up as soon as any changes are made to the form by an onclick event handler.

In total I have three pages but the first one ("default.asp") only consists of a frameset (so there is no problem). The two other pages ("main.asp") and ("sum.asp") are where I have problems. Particularly I feel I have problems with the ("sum.asp"), and maybe some minor with the "main.asp".

Inside the "sum.asp" I have written some additional clarifications. I guess I need some kind of SQL code to get it right....
Hope to get some assistance...


URL “default.asp”

<FRAMESET ROWS="*,100">
    <FRAME NAME="main" src="main.asp” Scrolling="auto">
    <FRAME NAME="sum" src=”sum.asp” Scrolling="no">
</FRAMESET>


URL “main.asp”

<html>

<head>

<title>
I can’t figure it out, please help me….
</title>

<Script language="JavaScript">
function update(formobject)
{
    document.form1.submit();
}
</Script>

</head>

<body>

Time for a very basic lesson in mathematics…

<form action="sum.asp" method= "post" name="form1">

<input type="radio" name="radio1" value="10" OnClick="update()" checked> <br>
<input type="radio" name="radio1" value="11" OnClick="update()"> +5 <br>

<input type="radio" name="radio2" value="20" OnClick=" update()" checked> <br>
<input type="radio" name="radio2" value="21" OnClick=" update()"> -5 <br>

<input type="checkbox" name="check3" value="30" OnClick=" update(this.form)" checked> <br>

<input type="checkbox" name="check4" value="40" OnClick=" update(this.form)"> +5 <br>

</form>

</body>

</html>


URL “sum.asp”

<html>
<head>
<title>
The total sum from the checked elements in the form should be displayed here
</title>
</head>
<body>

<%radio1 = request.form1("radio1")%>
<%radio2 = request.form1("radio2")%>
<%check3 = request.form1("check3")%>
<%check4 = request.form1("check4")%>

// Unless I am wrong the values from the selected elements in the form should now be retrieved and stored in the 4 different variables above. Now I wonder how I can retrieve some prices from an Access database named “products” and a column named “price” for each of the above mentioned variables. In the database there is also a column named “product ID” (that corresponds to the values stored in the variables above and therefore should be used to identify each record). I want the 2 (depending on the checkboxes) or 4 prices added to a variable named “sum”. As you can se below I want the “sum” variable to be displayed to the user. Since I have an “onclick”-event on the “main.asp” URL I want the “sum” variable to be updated as soon any change is made in the form. The default value of “sum” should be 30 since the checked form elements’ prices are 10 each (if they are retrieved correctly from the database) :). //

The sum of the chosen radio buttons and checkboxes is:
<%
Response.Write sum
%>

</body>
</html>








Similar Threads
Thread Thread Starter Forum Replies Last Post
importing excel data into access forms navdeepsinghparmar Access 1 November 7th, 2007 01:27 PM
Access Bound forms - auto saving data! jscully Access 6 January 17th, 2005 07:09 PM
How can I retrieve data from Access dadabase in PD imfriend Classic ASP Databases 1 January 12th, 2004 10:49 AM
Data in Word forms in Access Tables HowardB Access VBA 1 January 9th, 2004 09:18 AM
Retrieve data from local Access files aslyon ADO.NET 2 October 31st, 2003 08:52 PM





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