Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

having trouble passing form variables

Status
Not open for further replies.

leadman

Programmer
Joined
Jun 11, 2001
Messages
177
Location
US
Hi all,
Im stumped here. Im sending all my cart variables to a page where folks can make final changes to anything they entered (shipping address, number of products, etc) Most of these variables are passed as hidden form fields to the edit page where they are used to populate input boxes with the same name which can be edited and sent back to the final checkout page again. The problem is that, upon return (after making changes), the variables are not changed but rather added to the previous value in list form. Here is an example.
On the page where the user makes a final check of all the info there is a button called "Edit Info" which sends, among other things, the following hidden variable:

<input type=&quot;hidden&quot; name=&quot;phone&quot; value=&quot;#form.phone#&quot;>

The value has been obtained, obviously, from a form that submitted to it. In this example, the value of #form.phone# is 123-456-7890 and has passed correctly as such to the next template (the one where values can be changed). The value is used to populate the following input box:

<cfinput type=&quot;Text&quot; name=&quot;phone&quot; message=&quot;Please enter billing phone with area code.&quot; validate=&quot;telephone&quot;
required=&quot;Yes&quot;
size=&quot;15&quot;
maxlength=&quot;25&quot;
value=&quot;#form.phone#&quot;>

On this template is a button at the bottom called &quot;Submit Edits&quot; which sends the field back to the first template with the new value (or with the old one if no change was made. NOW - when it gets back the original template, the code that displays this value (#form.phone#)shows the following value:

123-456-7890,123-456-7890

It has two of this same value! This is happening to all the varibles being sent back (address, name, email, etc). And if the user had made a change to a value then the result is the original value, then a comma, then the new value. Why is this simple passing of form variables causing a list to form?
 
hey Leadman,

I can't be sure what is happening without seeing the code. But one thing that will cause that for sure is if:

<input type=&quot;hidden&quot; name=&quot;phone&quot; value=&quot;#form.phone#&quot;>

That line and

<cfinput type=&quot;Text&quot; name=&quot;phone&quot; message=&quot;Please enter billing phone with area code.&quot; validate=&quot;telephone&quot;
required=&quot;Yes&quot;
size=&quot;15&quot;
maxlength=&quot;25&quot;
value=&quot;#form.phone#&quot;>

That line get submitted at the same time. That would for sure cause a list of both values. If that isn't the problem, post more code. Or maybe someone else has an idea?

hope I helped...
 
okay here is all the code (i hope it's not too long for here - thanks tl:

<cfset dbfields=&quot;firstname,lastname,phone,fax,email,address1,address2,city,state,zip&quot;>
<cfset dbfields2=&quot;sfirstname,slastname,sphone,sfax,semail,saddress1,saddress2,scity,sstate,szip&quot;>

<!---- This code was changed to allow for graphic submit buttons --->
<cfif isdefined(&quot;form.upper&quot;)>
<!---- <cfif trim(form.action) eq &quot;+&quot;> --->
<cf_addItem
strProdID=&quot;#form.id#&quot;
strProdName=&quot;#form.name#&quot;
curPrice=&quot;#form.price#&quot;
quantity=&quot;#form.quantity#&quot;
numWeight=&quot;#form.weight#&quot;
>
<!---- <cfelseif trim(form.action) eq &quot;-&quot;> --->
</cfif>
<cfif isdefined(&quot;form.downer&quot;)>
<cf_dropItem strProdName=&quot;#form.name#&quot;>
</cfif>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>
<cfinclude template=&quot;checkout_header3.html&quot;>
<table width=&quot;100%&quot; border=&quot;0&quot;>
<tr>
<td width=&quot;125&quot; valign=&quot;top&quot;>
<cfinclude template=&quot;checkout_leftborder.cfm&quot;></td>
<td width=&quot;796&quot; valign=&quot;top&quot;>

<table width=&quot;80%&quot; border=&quot;0&quot; align=&quot;center&quot;>
<tr>
<td width=&quot;9%&quot;></td>
<td width=&quot;66%&quot;><font face=&quot;Arial, Helvetica, sans-serif&quot;><b>Click on
the &quot;Submit Edits&quot; button at the bottom of the page when
finished editing.</b></font></td>
<td width=&quot;25%&quot;>&nbsp;</td>
</tr>
<tr>
<td width=&quot;9%&quot;></td>
<td width=&quot;66%&quot;>&nbsp;</td>
<td width=&quot;25%&quot;>&nbsp;</td>
</tr>
<tr>
<td width=&quot;9%&quot;></td>
<td width=&quot;66%&quot;><font face=&quot;Arial, Helvetica, sans-serif&quot;>Edit Shopping
Cart</font></td>
<td width=&quot;25%&quot;>&nbsp;</td>
</tr>
<tr>
<td width=&quot;9%&quot; valign=&quot;top&quot;></td>
<td width=&quot;66%&quot; valign=&quot;top&quot;>
<table border=1 width=100% cellspacing=1>
<tr bgcolor=&quot;#51D89E&quot;>
<td colspan=3 align=center><font face=&quot;arial&quot; size=4 color=white>Shopping
Cart Contents</font></td>
</tr>
<tr bgcolor=&quot;#A6EBCE&quot;>
<td><font face=&quot;arial&quot; size=&quot;2&quot; color=&quot;#000000&quot;>Product</font></td>
<td width=&quot;100&quot;><font face=&quot;arial&quot; size=&quot;2&quot; color=&quot;#000000&quot;>Quantity</font></td>
<td align=right><font face=&quot;arial&quot; size=&quot;2&quot; color=&quot;#000000&quot;>Price</font></td>
</tr>
<!--- Make sure that the shopping cart structure exists and is the correct format --->
<CFLOCK NAME=&quot;CART&quot; TYPE=&quot;READONLY&quot; TIMEOUT=&quot;10&quot;>
<cfif isdefined(&quot;session.cart&quot;)>
<cfif IsStruct(session.cart)>
<!--- Initialize variables --->
<cfset subtotal = 0>
<cfoutput>
<!---
To output the contents, all we're going to do is loop over our cart structure one item at a time --->
<cfloop collection=&quot;#session.cart#&quot; item=&quot;i&quot;>
<!--- This is the workhorse that will output the item info --->
<cfset subtotal = subtotal + (session.cart[4] * session.cart[3])>
<tr>
<td valign=top><font face=&quot;arial&quot; size=2>#session.cart[2]#</font></td>
<!--- This is the original show cart code
<td valign=top><font face=&quot;arial&quot; size=2>#session.cart[4]#</font></td> --->
<!---- This is the modified code created during the checkout counter portion --->
<td valign=top>
<table border=0 width=100%>
<tr>
<td><font face=&quot;arial&quot; size=3>#session.cart[4]#</font></td>
<form method=&quot;post&quot; name=&quot;cartadd&quot; action=&quot;checkout_edit.cfm&quot;>
<input type=&quot;hidden&quot; name=&quot;upper&quot; value=&quot;up&quot;>
<input type=&quot;hidden&quot; name=&quot;name&quot; value=&quot;#session.cart[2]#&quot;>
<input type=&quot;hidden&quot; name=&quot;id&quot; value=&quot;#session.cart[1]#&quot;>
<input type=&quot;hidden&quot; name=&quot;price&quot; value=&quot;#session.cart[3]#&quot;>
<input type=&quot;hidden&quot; name=&quot;weight&quot; value=&quot;#session.cart[5]#&quot;>
<input type=&quot;hidden&quot; name=&quot;quantity&quot; value=&quot;1&quot;>

<input type=&quot;hidden&quot; name=&quot;cardtype&quot; value=&quot;#form.cardtype#&quot;>
<input type=&quot;hidden&quot; name=&quot;cardname&quot; value=&quot;#form.cardname#&quot;>
<input type=&quot;hidden&quot; name=&quot;x_Card_Num&quot; value=&quot;#form.x_Card_Num#&quot;>
<input type=&quot;hidden&quot; name=&quot;x_Exp_Date&quot; value=&quot;#form.x_Exp_Date#&quot;>
<input type=&quot;hidden&quot; name=&quot;totwship&quot; value=&quot;#form.totwship#&quot;>
<input type=&quot;hidden&quot; name=&quot;total&quot; value=&quot;#form.total#&quot;>
<input type=&quot;hidden&quot; name=&quot;shipcost&quot; value=&quot;#form.shipcost#&quot;>
<input type=&quot;hidden&quot; name=&quot;shipping&quot; value=&quot;#form.shipping#&quot;>
<input type=&quot;hidden&quot; name=&quot;cartweight&quot; value=&quot;#form.cartweight#&quot;>
<cfif isDefined(&quot;form.giftwrapOn&quot;)>
<input type=&quot;hidden&quot; name=&quot;giftwrapOn&quot; value=&quot;#form.giftwrapOn#&quot;>
</cfif>
<cfif isDefined(&quot;form.giftTexton&quot;)>
<input type=&quot;hidden&quot; name=&quot;giftTexton&quot; value=&quot;#form.giftTexton#&quot;>
</cfif>
<cfif isDefined(&quot;form.giftwrapOn&quot;) AND form.giftwrapOn EQ &quot;yes&quot;>
<input type=&quot;hidden&quot; name=&quot;giftStyle&quot; value=&quot;#form.giftStyle#&quot;>
</cfif>
<cfif isDefined(&quot;form.giftTexton&quot;) AND form.giftTexton EQ &quot;yes&quot;>
<input type=&quot;hidden&quot; name=&quot;giftText&quot; value=&quot;#form.giftText#&quot;>
</cfif>

<input type=&quot;hidden&quot; name=&quot;firstname&quot; value=&quot;#form.firstname#&quot;>
<input type=&quot;hidden&quot; name=&quot;lastname&quot; value=&quot;#form.lastname#&quot;>
<input type=&quot;hidden&quot; name=&quot;phone&quot; value=&quot;#form.phone#&quot;>
<input type=&quot;hidden&quot; name=&quot;fax&quot; value=&quot;#form.fax#&quot;>
<input type=&quot;hidden&quot; name=&quot;email&quot; value=&quot;#form.email#&quot;>
<input type=&quot;hidden&quot; name=&quot;address1&quot; value=&quot;#form.address1#&quot;>
<input type=&quot;hidden&quot; name=&quot;address2&quot; value=&quot;#form.address2#&quot;>
<input type=&quot;hidden&quot; name=&quot;city&quot; value=&quot;#form.city#&quot;>
<input type=&quot;hidden&quot; name=&quot;state&quot; value=&quot;#form.state#&quot;>
<input type=&quot;hidden&quot; name=&quot;zip&quot; value=&quot;#form.zip#&quot;>

<input type=&quot;hidden&quot; name=&quot;sfirstname&quot; value=&quot;#form.sfirstname#&quot;>
<input type=&quot;hidden&quot; name=&quot;slastname&quot; value=&quot;#form.slastname#&quot;>
<input type=&quot;hidden&quot; name=&quot;sphone&quot; value=&quot;#form.sphone#&quot;>
<input type=&quot;hidden&quot; name=&quot;sfax&quot; value=&quot;#form.sfax#&quot;>
<input type=&quot;hidden&quot; name=&quot;semail&quot; value=&quot;#form.semail#&quot;>
<input type=&quot;hidden&quot; name=&quot;saddress1&quot; value=&quot;#form.saddress1#&quot;>
<input type=&quot;hidden&quot; name=&quot;saddress2&quot; value=&quot;#form.saddress2#&quot;>
<input type=&quot;hidden&quot; name=&quot;scity&quot; value=&quot;#form.scity#&quot;>
<input type=&quot;hidden&quot; name=&quot;sstate&quot; value=&quot;#form.sstate#&quot;>
<input type=&quot;hidden&quot; name=&quot;szip&quot; value=&quot;#form.szip#&quot;>

<td align=right>
<input type=&quot;image&quot; src=&quot;images/plus.gif&quot; name=&quot;action2&quot; value=&quot; + &quot;>
</td>
</form>
<form method=&quot;post&quot; name=&quot;cartsubtract&quot; action=&quot;checkout_edit.cfm&quot;>
<input type=&quot;hidden&quot; name=&quot;downer&quot; value=&quot;down&quot;>
<input type=&quot;hidden&quot; name=&quot;name&quot; value=&quot;#session.cart[2]#&quot;>
<input type=&quot;hidden&quot; name=&quot;id&quot; value=&quot;#session.cart[1]#&quot;>
<input type=&quot;hidden&quot; name=&quot;price&quot; value=&quot;#session.cart[3]#&quot;>
<input type=&quot;hidden&quot; name=&quot;weight&quot; value=&quot;#session.cart[5]#&quot;>
<input type=&quot;hidden&quot; name=&quot;quantity&quot; value=&quot;1&quot;>

<input type=&quot;hidden&quot; name=&quot;cardtype&quot; value=&quot;#form.cardtype#&quot;>
<input type=&quot;hidden&quot; name=&quot;cardname&quot; value=&quot;#form.cardname#&quot;>
<input type=&quot;hidden&quot; name=&quot;x_Card_Num&quot; value=&quot;#form.x_Card_Num#&quot;>
<input type=&quot;hidden&quot; name=&quot;x_Exp_Date&quot; value=&quot;#form.x_Exp_Date#&quot;>
<input type=&quot;hidden&quot; name=&quot;totwship&quot; value=&quot;#form.totwship#&quot;>
<input type=&quot;hidden&quot; name=&quot;total&quot; value=&quot;#form.total#&quot;>
<input type=&quot;hidden&quot; name=&quot;shipcost&quot; value=&quot;#form.shipcost#&quot;>
<input type=&quot;hidden&quot; name=&quot;shipping&quot; value=&quot;#form.shipping#&quot;>
<input type=&quot;hidden&quot; name=&quot;cartweight&quot; value=&quot;#form.cartweight#&quot;>
<cfif isDefined(&quot;form.giftwrapOn&quot;)>
<input type=&quot;hidden&quot; name=&quot;giftwrapOn&quot; value=&quot;#form.giftwrapOn#&quot;>
</cfif>
<cfif isDefined(&quot;form.giftTexton&quot;)>
<input type=&quot;hidden&quot; name=&quot;giftTexton&quot; value=&quot;#form.giftTexton#&quot;>
</cfif>
<cfif isDefined(&quot;form.giftwrapOn&quot;) AND form.giftwrapOn EQ &quot;yes&quot;>
<input type=&quot;hidden&quot; name=&quot;giftStyle&quot; value=&quot;#form.giftStyle#&quot;>
</cfif>
<cfif isDefined(&quot;form.giftTexton&quot;) AND form.giftTexton EQ &quot;yes&quot;>
<input type=&quot;hidden&quot; name=&quot;giftText&quot; value=&quot;#form.giftText#&quot;>
</cfif>
<input type=&quot;hidden&quot; name=&quot;firstname&quot; value=&quot;#form.firstname#&quot;>
<input type=&quot;hidden&quot; name=&quot;lastname&quot; value=&quot;#form.lastname#&quot;>
<input type=&quot;hidden&quot; name=&quot;phone&quot; value=&quot;#form.phone#&quot;>
<input type=&quot;hidden&quot; name=&quot;fax&quot; value=&quot;#form.fax#&quot;>
<input type=&quot;hidden&quot; name=&quot;email&quot; value=&quot;#form.email#&quot;>
<input type=&quot;hidden&quot; name=&quot;address1&quot; value=&quot;#form.address1#&quot;>
<input type=&quot;hidden&quot; name=&quot;address2&quot; value=&quot;#form.address2#&quot;>
<input type=&quot;hidden&quot; name=&quot;city&quot; value=&quot;#form.city#&quot;>
<input type=&quot;hidden&quot; name=&quot;state&quot; value=&quot;#form.state#&quot;>
<input type=&quot;hidden&quot; name=&quot;zip&quot; value=&quot;#form.zip#&quot;>

<input type=&quot;hidden&quot; name=&quot;sfirstname&quot; value=&quot;#form.sfirstname#&quot;>
<input type=&quot;hidden&quot; name=&quot;slastname&quot; value=&quot;#form.slastname#&quot;>
<input type=&quot;hidden&quot; name=&quot;sphone&quot; value=&quot;#form.sphone#&quot;>
<input type=&quot;hidden&quot; name=&quot;sfax&quot; value=&quot;#form.sfax#&quot;>
<input type=&quot;hidden&quot; name=&quot;semail&quot; value=&quot;#form.semail#&quot;>
<input type=&quot;hidden&quot; name=&quot;saddress1&quot; value=&quot;#form.saddress1#&quot;>
<input type=&quot;hidden&quot; name=&quot;saddress2&quot; value=&quot;#form.saddress2#&quot;>
<input type=&quot;hidden&quot; name=&quot;scity&quot; value=&quot;#form.scity#&quot;>
<input type=&quot;hidden&quot; name=&quot;sstate&quot; value=&quot;#form.sstate#&quot;>
<input type=&quot;hidden&quot; name=&quot;szip&quot; value=&quot;#form.szip#&quot;>
<td align=right>
<input type=&quot;image&quot; name=&quot;action&quot; src=&quot;images/minus.gif&quot; value=&quot; - &quot;>
</td>
</form>
</tr>
</table>
</td>
<!---- This is the modified code created during the checkout counter portion --->
<td valign=top align=right><font face=&quot;arial&quot; size=2>#dollarformat(session.cart[3])#</font></td>
</tr>
</cfloop>
</cfoutput>
</cfif>
</cfif>
</cflock>
<cfset total=subtotal>
<!--- This is where we print out the summary info that we just calculated --->
<tr>
<td colspan=3><br>
</td>
</tr>
<tr>
<!--- This piece was added during the checkout counter phase --->
<cfoutput>
<td align=right><font face=&quot;arial&quot; size=2>SubTotal</font></td>
<td align=right><font face=&quot;arial&quot; size=2>#dollarformat(subtotal)#</font></td>
</cfoutput>
</tr>

</table>
</td>
<td width=&quot;25%&quot;>&nbsp;</td>
</tr>
<tr>
<td width=&quot;9%&quot; valign=&quot;top&quot;></td>
<td width=&quot;66%&quot; valign=&quot;top&quot;>&nbsp;</td>
<td width=&quot;25%&quot;>&nbsp;</td>
</tr>
<tr>
<td width=&quot;9%&quot; valign=&quot;top&quot; height=&quot;22&quot;></td>
<!--- this loops through the cart adding each product weight to get total cart weight --->
<cfset cartweight = 0>
<CFLOCK NAME=&quot;CART&quot; TYPE=&quot;READONLY&quot; TIMEOUT=&quot;10&quot;>
<cfloop collection=&quot;#session.cart#&quot; item=&quot;i&quot;>
<cfset cartweight = cartweight + ((session.cart[5]) * (session.cart[4]))>
</cfloop>
</cflock>
<td width=&quot;66%&quot; valign=&quot;top&quot; height=&quot;22&quot;><font face=&quot;Arial, Helvetica, sans-serif&quot;>Edit
Shipping Options.:</font></td>
<td width=&quot;25%&quot; height=&quot;22&quot;>&nbsp;</td>
</tr>
<tr>
<td width=&quot;9%&quot; valign=&quot;top&quot;></td>
<cfform name=&quot;form1&quot; method=&quot;post&quot; action=&quot;cc_info2.cfm&quot;>
<td rowspan=&quot;4&quot; valign=&quot;top&quot;>
<table border=0 width=100%>
<tr>
<td colspan=2>
<div align=&quot;center&quot;><font size=&quot;4&quot; face=&quot;arial&quot;>Shipping Options</font>
</div>
</td>
</tr>
<tr>
<td colspan=2>
<table border=0 width=100%><cfoutput>
<tr>
<td align=left width=&quot;150&quot;> <font face=&quot;arial&quot; size=2>
<input type=radio name=&quot;shipping&quot;
value=1DA <cfif form.shipping EQ &quot;1DA&quot;>checked</cfif>>
Next Day Air</font></td>
<cf_UPSPrice SERVICE=&quot;1DA&quot; FROM=&quot;06851&quot; TO=&quot;#form.szip#&quot; WEIGHT=&quot;#cartweight#&quot;>
<cfif isDefined(&quot;UPS_Charge&quot;) and UPS_Charge gt 0>
<cfset ndaPrice=#UPS_Charge# + 2>
</cfif>
<td align=left>#DollarFormat(ndaPrice)#</td>
<td align=right rowspan=&quot;3&quot;></td>
</tr>
<tr>
<td align=left width=&quot;150&quot;><font face=&quot;arial&quot; size=2>
<input type=radio name=&quot;shipping&quot;
value=2DA <cfif form.shipping EQ &quot;2DA&quot;>checked</cfif>>
2nd Day Air</font></td>
<cf_UPSPrice SERVICE=&quot;2DA&quot; FROM=&quot;06851&quot; TO=&quot;#form.szip#&quot; WEIGHT=&quot;#cartweight#&quot;>
<cfif isDefined(&quot;UPS_Charge&quot;) and UPS_Charge gt 0>
<cfset sdaPrice=#UPS_Charge# + 2>
</cfif>
<td align=left>#DollarFormat(sdaPrice)#</td>
</tr>
<tr>
<td align=left width=&quot;150&quot;><font face=&quot;arial&quot; size=2>
<input type=radio name=&quot;shipping&quot;
value=3GNDRES <cfif form.shipping EQ &quot;3GNDRES&quot;>checked</cfif>>
Ground </font> </td>
<cf_UPSPrice SERVICE=&quot;GNDRES&quot; FROM=&quot;06851&quot; TO=&quot;#form.szip#&quot; WEIGHT=&quot;#cartweight#&quot;>
<cfif isDefined(&quot;UPS_Charge&quot;) and UPS_Charge gt 0>
<cfset gndPrice=#UPS_Charge# + 2>
</cfif>
<td align=left>#DollarFormat(gndPrice)#</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan=2 height=&quot;59&quot;>
<table border=0 width=100%>
<tr>
<td width=&quot;150&quot;>
<input type=&quot;checkbox&quot; name=&quot;giftwrapOn&quot;
<cfif isDefined(&quot;form.giftwrapOn&quot;) AND form.giftwrapOn EQ &quot;yes&quot;>checked
</cfif>
value=&quot;yes&quot;>
<font size=2 face=arial>Gift Wrapping</font> </td>
<td bgcolor=&quot;orange&quot; width=&quot;50&quot;>
<input type=&quot;radio&quot;
<cfif isDefined(&quot;form.giftStyle&quot;) AND form.giftStyle EQ &quot;1&quot;>checked
</cfif>name=&quot;giftStyle&quot; value=1>
</td>
<td bgcolor=&quot;yellow&quot; width=&quot;50&quot;>
<input type=&quot;radio&quot;
<cfif isDefined(&quot;form.giftStyle&quot;) AND form.giftStyle EQ &quot;2&quot;>checked
</cfif>name=&quot;giftStyle&quot; value=2>
</td>
<td bgcolor=&quot;red&quot; width=&quot;50&quot;>
<input type=&quot;radio&quot;
<cfif isDefined(&quot;form.giftStyle&quot;) AND form.giftStyle EQ &quot;3&quot;>checked
</cfif>name=&quot;giftStyle&quot; value=3>
</td>
<td bgcolor=&quot;green&quot; width=&quot;50&quot;>
<input type=&quot;radio&quot;
<cfif isDefined(&quot;form.giftStyle&quot;) AND form.giftStyle EQ &quot;4&quot;>checked
</cfif>name=&quot;giftStyle&quot; value=4>
</td>
<td> </td>
<td>&nbsp;</td>
</tr>
<tr>
<td width=&quot;150&quot;>&nbsp; </td>
<td bgcolor=&quot;blue&quot; width=&quot;50&quot;>
<input type=&quot;radio&quot;
<cfif isDefined(&quot;form.giftStyle&quot;) AND form.giftStyle EQ &quot;5&quot;>checked
</cfif>name=&quot;giftStyle&quot; value=5>
</td>
<td bgcolor=&quot;aqua&quot; width=&quot;50&quot;>
<input type=&quot;radio&quot;
<cfif isDefined(&quot;form.giftStyle&quot;) AND form.giftStyle EQ &quot;6&quot;>checked
</cfif>name=&quot;giftStyle&quot; value=6>
</td>
<td bgcolor=&quot;purple&quot; width=&quot;50&quot;>
<input type=&quot;radio&quot;
<cfif isDefined(&quot;form.giftStyle&quot;) AND form.giftStyle EQ &quot;7&quot;>checked
</cfif>name=&quot;giftStyle&quot; value=7>
</td>
<td width=&quot;50&quot;>&nbsp; </td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan=2>
<table border=0 width=100%>
<tr>
<td valign=top width=&quot;150&quot;>
<input type=&quot;checkbox&quot;
<cfif isDefined(&quot;form.giftText&quot;) AND form.giftText NEQ &quot;&quot;>
checked</cfif> name=&quot;giftTexton&quot; value=&quot;yes&quot;>
<font size=2 face=arial>Gift Card Text</font> </td>
<td align=left>
<textarea cols=34 rows=5 name=&quot;giftText&quot;>
<cfif isDefined(&quot;form.giftText&quot;) AND form.giftText NEQ &quot;&quot;>
#form.giftText#</cfif>
</textarea>
</td>
</tr></cfoutput>
<cfoutput>
<input type=&quot;hidden&quot; name=&quot;cartweight&quot; value=&quot;#cartweight#&quot;>
<input type=&quot;hidden&quot; name=&quot;ndaPrice&quot; value=&quot;#ndaPrice#&quot;>
<input type=&quot;hidden&quot; name=&quot;sdaPrice&quot; value=&quot;#sdaPrice#&quot;>
<input type=&quot;hidden&quot; name=&quot;gndPrice&quot; value=&quot;#gndPrice#&quot;>
<input type=&quot;hidden&quot; name=&quot;total&quot; value=&quot;#total#&quot;>
</cfoutput>

<tr> <cfoutput>
<cfloop list=&quot;#dbfields#&quot; index=&quot;i&quot;>
<input type=&quot;hidden&quot; name=&quot;#i#&quot; value=&quot;#evaluate(i)#&quot;>
</cfloop>
<cfloop list=&quot;#dbfields2#&quot; index=&quot;i&quot;>
<input type=&quot;hidden&quot; name=&quot;#i#&quot; value=&quot;#evaluate(i)#&quot;>
</cfloop>
</cfoutput>
<td valign=top width=&quot;150&quot;>&nbsp; </td>
<td align=right> &nbsp; &nbsp;</td>
</tr>
</table>
</td>
</tr>
</table>
<font face=&quot;Arial, Helvetica, sans-serif&quot;>Edit Billing Info: </font>
<table border=0 width=100%>
<tr>
<td colspan=2>
<div align=&quot;center&quot;><font face='arial' size=2><font size=&quot;4&quot;>Bill
To</font></font></div>
</td>
</tr>
<cfoutput>
<tr>
<td><font face=&quot;arial&quot; size=&quot;1&quot; color=&quot;##FF0000&quot;><b>Firstname</b></font></td>
<td>
<cfinput type=&quot;Text&quot; name=&quot;firstname&quot;
message=&quot;Please Enter firstname&quot;
required=&quot;Yes&quot;
size=&quot;15&quot;
maxlength=&quot;25&quot;
value=&quot;#form.firstname#&quot;>
</td>
</tr>
<tr>
<td><font face=&quot;arial&quot; size=&quot;1&quot; color=&quot;##FF0000&quot;><b>Lastname</b></font></td>
<td>
<cfinput type=&quot;Text&quot;
name=&quot;lastname&quot;
message=&quot;Please enter last name&quot;
required=&quot;Yes&quot;
size=&quot;15&quot;
maxlength=&quot;25&quot;
value=&quot;#form.lastname#&quot;>
</td>
</tr>
<tr>
<td><font face=&quot;arial&quot; size=1><b><font color=&quot;##FF0000&quot;>Phone</font></b></font></td>
<td>
<cfinput type=&quot;Text&quot;
name=&quot;phone&quot;
message=&quot;Please enter billing phone with area code.&quot;
validate=&quot;telephone&quot;
required=&quot;Yes&quot;
size=&quot;15&quot;
maxlength=&quot;25&quot;
value=&quot;#form.phone#&quot;>
</td>
</tr>
<tr>
<td><font face=&quot;arial&quot; size=1>Fax</font></td>
<td>
<input type=&quot;text&quot; name=&quot;fax&quot; size=&quot;15&quot; maxlength=&quot;25&quot;
<cfif isDefined(&quot;form.fax&quot;)>value=&quot;#form.fax#&quot;</cfif>>
</td>
</tr>
<tr>
<td><font face=&quot;arial&quot; size=&quot;1&quot; color=&quot;##FF0000&quot;><b>Email</b></font></td>
<td>
<cfinput type=&quot;Text&quot;
name=&quot;email&quot;
message=&quot;Please enter billing email address&quot;
required=&quot;Yes&quot;
size=&quot;23&quot;
maxlength=&quot;35&quot;
value=&quot;#form.email#&quot;>
</td>
</tr>
<tr>
<td><font face=&quot;arial&quot; size=&quot;1&quot; color=&quot;##FF0000&quot;><b>Address1</b></font></td>
<td>
<cfinput type=&quot;Text&quot;
name=&quot;address1&quot;
message=&quot;Please enter billing address.&quot;
required=&quot;Yes&quot;
size=&quot;15&quot;
maxlength=&quot;25&quot;
value=&quot;#form.address1#&quot;>
</td>
</tr>
<tr>
<td><font face=&quot;arial&quot; size=1>Address2</font></td>
<td>
<input type=&quot;text&quot; name=&quot;address2&quot; size=&quot;15&quot; maxlength=&quot;25&quot;
<cfif isDefined(&quot;form.address2&quot;)>value=&quot;#form.address2#&quot;</cfif>>
</td>
</tr>
<tr>
<td><font face=&quot;arial&quot; size=&quot;1&quot; color=&quot;##FF0000&quot;><b>City</b></font></td>
<td>
<cfinput type=&quot;Text&quot;
name=&quot;city&quot;
message=&quot;Please enter billing city.&quot;
required=&quot;Yes&quot;
size=&quot;15&quot;
maxlength=&quot;25&quot;
value=&quot;#form.city#&quot;>
</td>
</tr>
<tr>
<td><font face=&quot;arial&quot; size=&quot;1&quot; color=&quot;##FF0000&quot;><b>State</b></font></td>
<td>
<cfinput type=&quot;Text&quot;
name=&quot;state&quot;
message=&quot;Please enter billing state.&quot;
required=&quot;Yes&quot;
size=&quot;2&quot;
maxlength=&quot;2&quot;
value=&quot;#form.state#&quot;>
</td>
</tr>
<tr>
<td><font face=&quot;arial&quot; size=&quot;1&quot; color=&quot;##FF0000&quot;><b>Zip</b></font></td>
<td>
<cfinput type=&quot;Text&quot;
name=&quot;zip&quot;
message=&quot;Please enter billing ZIP code.&quot;
validate=&quot;zipcode&quot;
required=&quot;Yes&quot;
size=&quot;10&quot;
maxlength=&quot;10&quot;
value=&quot;#form.zip#&quot;>
</td>
</tr>
</cfoutput>
</table>
<font face=&quot;Arial, Helvetica, sans-serif&quot;>Edit Shipping Info.: </font>
<cfoutput>
<table border=0 width=100%>
<tr bgcolor=&quot;##51D89E&quot;>
<td colspan=&quot;2&quot;>
<div align=&quot;center&quot;><font face=&quot;arial&quot; size=&quot;4&quot; color=&quot;##FFFFFF&quot;>Ship
To</font> </div>
</td>
</tr>
<tr>
<td><font face=&quot;arial&quot; size=1>Firstname</font></td>
<td>
<input type=&quot;text&quot; name=&quot;sfirstname&quot; size=&quot;15&quot;
<cfif isDefined(&quot;form.sfirstname&quot;)>value=&quot;#form.sfirstname#&quot;</cfif> maxlength=&quot;25&quot;>
</td>
</tr>
<tr>
<td><font face=&quot;arial&quot; size=1>Lastname</font></td>
<td>
<input type=&quot;text&quot; name=&quot;slastname&quot; size=&quot;15&quot;
<cfif isDefined(&quot;form.slastname&quot;)>value=&quot;#form.slastname#&quot;</cfif> maxlength=&quot;25&quot;>
</td>
</tr>
<tr>
<td><font face=&quot;arial&quot; size=1>Phone</font></td>
<td>
<input type=&quot;text&quot; name=&quot;sphone&quot; size=&quot;15&quot;
<cfif isDefined(&quot;form.sphone&quot;)>value=&quot;#form.sphone#&quot;</cfif> maxlength=&quot;25&quot;>
</td>
</tr>
<tr>
<td><font face=&quot;arial&quot; size=1>Fax</font></td>
<td>
<input type=&quot;text&quot; name=&quot;sfax&quot; size=&quot;15&quot;
<cfif isDefined(&quot;form.sfax&quot;)>value=&quot;#form.sfax#&quot;</cfif> maxlength=&quot;25&quot;>
</td>
</tr>
<tr>
<td><font face=&quot;arial&quot; size=1>Email</font></td>
<td>
<input type=&quot;text&quot; name=&quot;semail&quot; size=&quot;15&quot;
<cfif isDefined(&quot;form.semail&quot;)>value=&quot;#form.semail#&quot;</cfif> maxlength=&quot;35&quot;>
</td>
</tr>
<tr>
<td><font face=&quot;arial&quot; size=&quot;1&quot; color=&quot;##FF0000&quot;><b>Address1</b></font></td>
<td>
<cfinput type=&quot;Text&quot;
name=&quot;saddress1&quot;
message=&quot;Please input a shipping address.&quot;
required=&quot;Yes&quot;
size=&quot;15&quot;
value=&quot;#form.saddress1#&quot;
maxlength=&quot;25&quot;>
</td>
</tr>
<tr>
<td><font face=&quot;arial&quot; size=1>Address2</font></td>
<td>
<input type=&quot;text&quot; name=&quot;saddress2&quot; size=&quot;15&quot;
<cfif isDefined(&quot;form.saddress2&quot;)>value=&quot;#form.saddress2#&quot;</cfif> maxlength=&quot;25&quot;>
</td>
</tr>
<tr>
<td><font face=&quot;arial&quot; size=&quot;1&quot; color=&quot;##FF0000&quot;><b>City</b></font></td>
<td>
<cfinput type=&quot;Text&quot;
name=&quot;scity&quot;
message=&quot;Please indicate city to ship to.&quot;
required=&quot;Yes&quot;
size=&quot;15&quot;
value=&quot;#form.scity#&quot;
maxlength=&quot;25&quot;>
</td>
</tr>
<tr>
<td><font face=&quot;arial&quot; size=&quot;1&quot; color=&quot;##FF0000&quot;><b>State</b></font></td>
<td>
<cfinput type=&quot;Text&quot;
name=&quot;sstate&quot;
message=&quot;Please indicate state to ship to.&quot;
required=&quot;Yes&quot;
size=&quot;2&quot;
value=&quot;#form.sstate#&quot;
maxlength=&quot;2&quot;>
</td>
</tr>
<tr>
<td><font face=&quot;arial&quot; size=&quot;1&quot; color=&quot;##FF0000&quot;><b>Zip</b></font></td>
<td>
<cfinput type=&quot;Text&quot;
name=&quot;szip&quot;
message=&quot;Please indicate ZIP code to ship to.&quot;
validate=&quot;zipcode&quot;
required=&quot;Yes&quot;
size=&quot;15&quot;
value=&quot;#form.szip#&quot;
maxlength=&quot;25&quot;>
</td>
</tr>
</table>
</cfoutput>
<font face=&quot;Arial, Helvetica, sans-serif&quot;>Edit Credit Card Info:
</font><br>
<table width=&quot;100%&quot; border=&quot;0&quot;>
<tr>
<td colspan=&quot;2&quot; valign=&quot;top&quot;>
<div align=&quot;center&quot;><font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;4&quot;>Credit
Card Information: </font></div>
</td>
</tr>
<tr>
<td width=&quot;139&quot; valign=&quot;top&quot;><font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;2&quot;><b>Card
Type:</b></font></td>
<td width=&quot;131&quot;>
<input type=radio name=&quot;cardtype&quot;
<cfif form.cardtype EQ &quot;Visa&quot;>checked</cfif> value=Visa>
Visa<br>
<input type=radio name=&quot;cardtype&quot;
<cfif form.cardtype EQ &quot;MasterCard&quot;>checked</cfif> value=MasterCard>
MasterCard<br>
<input type=radio name=&quot;cardtype&quot;
<cfif form.cardtype EQ &quot;Discover&quot;>checked</cfif>value=Discover>
Discover </td>
</tr>
<tr>
<td width=&quot;139&quot;><b><font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;2&quot;>Card
No.:</font></b></td>
<td width=&quot;131&quot;>
<cfinput type=&quot;Text&quot;
name=&quot;x_Card_Num&quot;
value=&quot;#form.x_Card_Num#&quot;
message=&quot;Please enter valid credit card number.&quot;
validate=&quot;creditcard&quot;
required=&quot;Yes&quot;
size=&quot;16&quot;
maxlength=&quot;20&quot;>
</td>
</tr>
<tr>
<td width=&quot;139&quot;><font size=&quot;2&quot; face=&quot;Arial, Helvetica, sans-serif&quot;><b>Name
on Card:</b></font></td>
<td width=&quot;131&quot;>
<cfinput type=&quot;Text&quot;
name=&quot;cardname&quot;
value=&quot;#form.cardname#&quot;
message=&quot;Please enter name as it appears on card.&quot;
required=&quot;Yes&quot;
size=&quot;20&quot;
maxlength=&quot;30&quot;>
</td>
</tr>
<tr>
<td width=&quot;139&quot;><font size=&quot;2&quot; face=&quot;Arial, Helvetica, sans-serif&quot;><b>Exp.
Date (mm/yy):</b></font></td>
<td width=&quot;131&quot;>
<cfinput type=&quot;Text&quot;
name=&quot;x_Exp_Date&quot;
value=&quot;#form.x_Exp_Date#&quot;
message=&quot;Please enter expiration date as mm/yy.&quot;
required=&quot;Yes&quot;
size=&quot;5&quot;
maxlength=&quot;5&quot;>
</td>
</tr>
<tr>
<td width=&quot;139&quot;> <cfoutput>
<input type=&quot;hidden&quot; name=&quot;total&quot; value=&quot;#total#&quot;>
<input type=&quot;hidden&quot; name=&quot;cartweight&quot; value=&quot;#cartweight#&quot;>
<input type=&quot;submit&quot; name=&quot;Submit_Edits&quot; value=&quot;Submit_Edits&quot;>
#total#</cfoutput> </td>
<td width=&quot;131&quot;></td>
</tr>
</table>
</td>
</cfform>
<td width=&quot;25%&quot;>&nbsp;</td>
</tr>
<tr>
<td width=&quot;9%&quot;>&nbsp;</td>
<td width=&quot;25%&quot;>&nbsp;</td>
</tr>
<tr>
<td width=&quot;9%&quot;>&nbsp;</td>
<td width=&quot;25%&quot;>&nbsp;</td>
</tr>
<tr>
<td width=&quot;9%&quot;>&nbsp;</td>
<td width=&quot;25%&quot;>&nbsp;</td>
</tr>
<tr>
<td width=&quot;9%&quot;>&nbsp;</td>
<td width=&quot;66%&quot;>&nbsp;</td>
<td width=&quot;25%&quot;>&nbsp;</td>
</tr>
</table>
<br>

</td>
</tr>
</table>
</body>
</html>
 
If you have two form fields with the same name (except for radio buttons, which are grouped together by having the same name), the value of the corresponding variable in ColdFusion will be a two-element list, one element for each of the form fields. Example:

<form>
<input type=&quot;text&quot; name=&quot;firstname&quot; value=&quot;#form.firstname#&quot;>
<input type=&quot;hidden&quot; name=&quot;firstname&quot; value=&quot;#form.firstname#&quot;>
<input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Submit&quot;>
</form>

Modify you code so that you do not have something like the exampe above. If you want to keep the values that were previously entered (or perhaps extracted from the database) in case the user deletes the text from the text field, you can still use hidden form fields, you will have to give them different names, though. Example:

<form>
<input type=&quot;text&quot; name=&quot;firstname&quot; value=&quot;#form.firstname#&quot;>
<input type=&quot;hidden&quot; name=&quot;firstname_orig&quot; value=&quot;#form.firstname#&quot;>
<input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Submit&quot;>
</form>

Then your template that processes this page can loop through the FIELDNAMES variable to see if any of them are blank. If so, it uses the value in the corresponding xxx_orig variable. A better way do handle this is to use Javascript form validadtion to prevent the user from submitting the page if it contains a blank field.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top