Ask a Question related to Coldfusion Database Access, Design and Development.
-
vj78 #1
Getting value from the Drop down list extracted fromdatabase
The sizes are printed correctly but I cant get the right value when I select
it. It will always return me the 1 st value in the size table even if I select
something else.
I am of the opinion that I am not doing something right in getting values in
<cfquery name="productinfo" datasource="products" >
SELECT *
FROM products
WHERE Products.SKU = #URL.SKU#
</cfquery>
<cfquery name="size" datasource="products">
SELECT *
FROM size
WHERE size.SKU = #URL.SKU#
</cfquery>
<select name="size">
<option selected></option>
<cfoutput query="size">
<option value="#size#" <cfif
(isDefined("productinfo.SKU"))></cfif>>#size#</option>
</cfoutput>
</select>
</form>
<cfoutput><br />
<cfoutput>
<center>
<FORM action="#getfilefrompath(cgi.script_name)#?SKU=#Pr oductinfo.SKU#"
method="post">
<input type="hidden" name="addName" value="#Productinfo.Desc#">
<input type="hidden" name="addID" value="#Productinfo.SKU#">
<input type="hidden" name="addPrice" value="#Productinfo.Price#">
<input type="hidden" name="addQty" value="1">
<input type="hidden" name="size" value="#size.size#">
<input type="submit" name="submit" value="#formVal#">
</form>
</center>
</cfoutput>
vj78 Guest
-
about drop down list box
i got two drop downlists when i select an item in dropdown list 1 the dropdown list 2 should be populated with the corresponding items from the... -
drop down list
How can I make a scrolling text box that allows the user to scroll up and down and then click on a word. For example, If I was making a dictionary,... -
drop down list and ASP.NET
Hi, I created an ASP.NET dropdown list and populated the list from an Access database via the Dreamweaver data set and ASP dropdown list... -
Dynamical populating a list that can be used as drop down list
Hi, I have a solution in which a person can be a member of one or more groups. In this case the groups are those used in the protection schema of... -
Drop Down List?
I am very new to FlashMX. (Just opened the program about a week ago and have spent time doing the lessons) Is it possible to create a mouse over... -
CF_Oracle #2
Re: Getting value from the Drop down list extracted fromdatabase
By the way 'size' is a reserved word in CF queries. So, it's not a good idea to use it foir table or fields names in any case.
CF_Oracle Guest
-
SQLMenace #3
Re: Getting value from the Drop down list extracted fromdatabase
SELECT *
FROM products
WHERE Products.SKU = #URL.SKU#
SELECT *
FROM size
WHERE size.SKU = #URL.SKU#
are you sure Products.SKU and size.SKU are both #URL.SKU#
SQLMenace Guest
-
vj78 #4
Re: Getting value from the Drop down list extracted fromdatabase
I have attached the code for 2 files
1. Productinfo1007.cfm
2. Addbutton1007.cfm (this file is included in productinfo1007.cfm file
in the code below)
To see this working use the link :
[url]http://www.leathersandfur.com/productinfo1007.cfm?SKU=1[/url]
Complete code for page //
[url]http://www.leathersandfur.com/productinfo1007.cfm?SKU=1[/url]
<!-- Page productinfo1007.cfm start -->
<cfif not isdefined("URL.SKU")>
<cflocation url="productinfo.cfm?SKU=1">
</cfif>
<cfquery name="productinfo" datasource="products" >
SELECT *
FROM products
WHERE Products.SKU = #URL.SKU#
</cfquery>
<cfquery name="size" datasource="products">
SELECT *
FROM size
WHERE size.SKU = #URL.SKU#
</cfquery>
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Leathers - Product Info</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="css/leftnavigation.css" rel="stylesheet" type="text/css" />
<link href="css/title.css" rel="stylesheet" type="text/css" />
<link href="css/footer.css" rel="stylesheet" type="text/css" />
<link href="css/main.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" >
function popUp(URL,SKU) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "',
'toolbar=0,scrollbars=0,location=0,statusbar=0,men ubar=0,resizable=1,width=500,h
eight=500');");
}
</script>
</head>
<body leftmargin="100" rightmargin="100">
<!--include title-->
<cfinclude template="title.cfm">
<!--set image path -->
<cfset image_src ="images/#productinfo.productimage#">
<cfset image_path =expandpath(image_src)>
<!--start-->
<table>
<td width="22%" height="500"><cfinclude
template="leftnavigation.cfm"></td>
<td width="891" valign="top">
<table width="400" height="229">
<tr>
<td width="414"> <cfoutput>
<cfif fileexists(image_path)>
<img src="../images/#productinfo.productimage#"
class="picture">
</cfif>
<cfif #productinfo.image2# is " ">
<cfelse>
<a href="javascript:popUp('Lpicture.cfm?SKU=#SKU#')"> <br />
<img src="images/enlarge.gif" width="13" height="13"
class="outline"/>
Click to Enlarge</a>
</cfif>
</td>
</cfoutput>
<td width="268"><cfoutput> <h2><br />
<strong>#Productinfo.Desc#</strong><font size="6"></font><br />
</h2></cfoutput>
<form >
Size:
<select name="size">
<option selected></option>
<cfoutput query="size">
<option value="#size#" <cfif
(isDefined("productinfo.SKU"))></cfif>>#size#</option>
</cfoutput>
</select>
</form>
<cfoutput><br />
Product Number: #productinfo.SKU# <br />
#productinfo.LongDesc#<br /><br />
Price: $#productinfo.Price#</p>
</td>
<td width="10"></cfoutput>
<!--third column-->
<td width="77">
<cfoutput>
<cfif #productinfo.quantity# lt 1>
<div class="special">SoldOut</div>
</cfif>
<br />
</cfoutput>
<br />
</td>
<tr>
<td> </td>
<td> <br> <cfoutput >
<!--- Insert Shopping Cart Functionality Here --->
<cfinclude template="addButton1007.cfm">
</cfoutput> </td>
<td></td>
</tr>
</table>
</td></tr></table>
<!--include foooter -->
<cfinclude template="footer.cfm">
</body>
</html>
<!-- end of productinfo1007.cfm -->
// then I included the addbutton code in the same form --- code for it is
<cfparam name="formVal" default="Add to Cart">
<cfparam name="SKU" default="">
<!--- Handle the addition of an item to the cart using our custom tag--->
<cfif isdefined("form.submit")>
<cfif form.submit eq FormVal>
<cf_addItem1007
id="#form.addID#"
name="#form.addName#"
price="#form.addPrice#"
quantity="#form.addQty#"
size="#form.size#">
<cflocation url="showcart1007.cfm">
</cfif>
</cfif>
<cfif len(SKU)>
<!--- Give user access to the Add button. - This form will point to whatever
page you include it on.
- It has to have access to the variables it references.
- You can build this out to automatically retrieve the info that is required
--->
<cfoutput>
<center>
<FORM action="#getfilefrompath(cgi.script_name)#?SKU=#Pr oductinfo.SKU#"
method="post">
<input type="hidden" name="addName" value="#Productinfo.Desc#">
<input type="hidden" name="addID" value="#Productinfo.SKU#">
<input type="hidden" name="addPrice" value="#Productinfo.Price#">
<input type="hidden" name="addQty" value="1">
<input type="hidden" name="size" value="#size.size#">
<input type="submit" name="submit" value="#formVal#">
</form>
</center>
</cfoutput>
</cfif>
vj78 Guest



Reply With Quote

