Help with PHP/Javascript calculating custom estimate

A

angler30

I've been fighting the code on our onine estimate form for hours. We
changed some variables, and now it stopped calculating. I imagine its
as simple as a quotation ot comma, but its driving us crazy. Does
anyone have any ideas? Here is the code:

<script language="JavaScript" type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i+
+) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0;
i<a.length; i++)
if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j+
+].src=a;}}
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document;
if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++)
x=d.forms[n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++)
x=MM_findObj(n,d.layers.document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array;
for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc)
x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<style type="text/css">
<!--
body { font-family:Tahoma,Arial,sans-serif; }
a:link { text-decoration:none; }
a:visited { text-decoration:none; }
a:hover { text-decoration:underline; }
a:active { text-decoration:none; }
-->
</style>
<script language="JavaScript">
<!--
function vernichten() {
self.close();
}

function est(form)
{
var sze = (form.awid.value * form.bleng.value);
form.size.value = sze;

var a = 0
var b = 0
var c = 0
var d = 0
var e = 0
var f = 0
var g = 0

if (form.apaper[0].checked == true)
var a = (sze * .07)
else if(form.apaper[1].checked == true)
var a = (sze * .055)
else if(form.apaper[2].checked == true)
var a = (sze * .08)
else if(form.apaper[3].checked == true)
var a = (sze * .10);
if (form.hang[0].checked)
b = 5
}
if (form.coat[0].checked == true)
var c = (sze * .025)
else if (form.coat[1].checked == true)
var c = (sze * .015)
else if (form.coat[2].checked == true)
var c = (sze * .025)

if (form.substrate[0].checked == true)
var d = (sze * .10)
else if (form.substrate[1].checked == true)
var d = (sze * .14)
else if (form.substrate[2].checked == true)
var d = (sze * .1)

if (form.stretch[0].checked == true)
var e = ((2 * form.awid.value * .40) + (2 * form.bleng.value * .40))
else if(form.stretch[1].checked == true)
var e = (2 * form.awid.value * .25 + 2 * form.bleng.value * .25);

if (form.decked.checked == true)
var f = (2 * form.awid.value * .10 + 2 * form.bleng.value * .10);

if (form.wrap.checked == true)
var g = (2 * form.awid.value * .05 + 2 * form.bleng.value * .05);

form.PriceInput.value = (a + b + c + d + e + f + g);

if (form.PriceInput.value < 15)
{
form.PriceInput.value = 15.00
}

form.apaper.value = (a)
if (form.apaper.value < 0)
{
form.apaper.value = 0.00
}
form.hang.value = (b)
if (form.hang.value < 0)
{
form.hang.value = 0.00
}
form.coat.value = (c)
if (form.coat.value < 0)
{
form.coat.value = 0.00
}
form.substrate.value = (d)
if (form.substrate.value < 0)
{
form.substrate.value = 0.00
}
form.stretch.value = (e)
if (form.stretch.value < 0)
{
form.stretch.value = 0.00
}
form.decked.value = (f)
if (form.decked.value < 0)
{
form.decked.value = 0.00
}
form.wrap.value = (g)
if (form.wrap.value < 0)
{
form.wrap.value = 0.00
}
}
//-->
</script>
</HEAD>


...........................

<form name="form1" method="post" action="">
<table width="75%" border="0" align="center">
<tr>
<td width="12%" height="4"><img src="images/
num_1.gif" width="47" height="48"></td>
<td colspan="3" height="4">
<h5>Choose your Material</h5>
</td>
</tr>
<tr>
<td width="12%" height="31">&nbsp;</td>
<td colspan="3" height="31">
<input type="radio" name="apaper"
value="Canvas - Torino 17M">
Canvas - Magiclee Torino 17M Canvas<br>
<input type="radio" name="apaper"
value="Photo Paper">
Photobase Poster Paper<br>
<input type="radio" name="apaper"
value="Verona Fine Art 225">
Fine Art Paper - Verona 225 Smooth<br>
<input type="radio" name="apaper"
value="Arches Fine Art 285">
Fine Art Paper - Arches 285 Textured Rag</
td>
</tr>
<tr>
<td colspan="4"><img src="images/a5.jpg"></
td>
</tr>
<tr>
<td width="12%" height="7"><img src="images/
num_2.gif" width="47" height="48"></td>
<td colspan="3" height="7">
<h5>Choose Your Finishing Options</h5>
</td>
</tr>
<tr>
<td width="12%">&nbsp;</td>
<td colspan="3"><b>Fine Art &amp; Watercolor
Paper Options</b></td>
</tr>
<tr>
<td width="12%" height="13">&nbsp;</td>
<td colspan="3" height="13">
<input type="checkbox" name="decked"
value="ON">
Deckled (Torn) Edges - Watercolor Paper
Only</td>
</tr>
<tr>
<td width="12%">&nbsp;</td>
<td colspan="3">&nbsp;</td>
</tr>
<tr>
<td width="12%">&nbsp;</td>
<td colspan="3"><b>Fine Art Canvas Options</
b></td>
</tr>
<tr>
<td width="12%">&nbsp;</td>
<td colspan="3">&nbsp;&nbsp;Protective
Coating</td>
</tr>
<tr>
<td width="12%">&nbsp;</td>
<td width="19%">
<input type="radio" name="coat"
value="Matte Coating">
Matte<br>
<input type="radio" name="coat"
value="Semi Gloss Coating">
Semi Gloss<br>
<input type="radio" name="coat"
value="Gloss Coating">
Gloss</td>
<td colspan="2">Canvas Only. Added UV
protection, adds
water and abrasive resistance. We always
recommend
coating.</td>
</tr>
<tr>
<td width="12%">&nbsp;</td>
<td colspan="3">&nbsp;&nbsp;Stretching</td>
</tr>
<tr>
<td width="12%">&nbsp;</td>
<td colspan="3">
<input type="radio" name="stretch"
value="stretched on 1 1/2 inch wood bars">
Heavy 1 1/2" Stretched <br>
<input type="radio" name="stretch"
value="stretched on 3/4 inch wood bars">
Lite 3/4&quot; Stretched</td>
</tr>
<tr>
<td width="12%">&nbsp;</td>
<td colspan="3">
<input type="checkbox" name="wrap"
value="ON">
Gallery Wrapped</td>
</tr>
<tr>
<td width="12%">&nbsp;</td>
<td colspan="3">&nbsp;&nbsp;Hanging</td>
</tr>
<tr>
<td width="12%" height="23">&nbsp;</td>
<td colspan="3" height="23">
<input type="radio" name="hang"
value="Hanging Wire">
Hanging hardware and wire</td>
</tr>
<tr>
<td width="12%">&nbsp;</td>
<td colspan="3">&nbsp;</td>
</tr>
<tr>
<td width="12%">&nbsp;</td>
<td colspan="3">&nbsp;<b>&nbsp;Solid Back
Substrate
Options</b></td>
</tr>
<tr>
<td width="12%" height="87">&nbsp;</td>
<td colspan="3" height="87">The following
options are
great for presentation, and include
printing on adhesive
backed paper, laminated, and mounted to
one of the
following substrates. Each substrate is
priced differently.<br>
<input type="radio" name="substrate"
value="1/4th gatorboard">
3/16&quot; Gatorboard<br>
<input type="radio" name="substrate"
value="1/2f gatorboard">
1/2&quot; Gatorboard<br>
<input type="radio" name="substrate"
value="MDF">
MDF </td>
</tr>
<tr>
<td colspan="4"><img src="images/a5.jpg"></
td>
</tr>
<tr>
<td width="12%"><img src="images/num_3.gif"
width="47" height="48"></td>
<td colspan="3">
<h5>Enter your Size Below</h5>
</td>
</tr>
<tr>
<td width="12%">&nbsp;</td>
<td colspan="3"><font face="Arial">
<input name="awid" size="3" maxlength="3"
value="">
</font><font
face="Arial">&nbsp;inches&nbsp;&nbsp;
&nbsp;x&nbsp;&nbsp;&nbsp; </font> <font
face="Arial">
<input name="bleng" size="3" maxlength="3"
value="">
&nbsp;inches</font></td>
</tr>
<tr>
<td colspan="4"><img src="images/a5.jpg"></
td>
</tr>
<tr>
<td width="12%"><img src="images/num_4.gif"
width="47" height="48"></td>
<td colspan="2"><font face="Arial">
<input type="button" value="Calculate
Print Price" onClick="est(this.form)" name="button">
</font></td>
<td width="40%"><font face="Arial">
<input type="reset" value="Clear Form"
name="reset">
</font></td>
</tr>
<tr>
<td width="12%">&nbsp;</td>
<td colspan="2">
<div align="center"><font
face="Arial"><b>Your price
per print $ </b>
<input name="PriceInput" size="8"
value="0">
<br>
<i>(CO residents pay 7.72% taxes)</i></
font></div>
</td>
<td width="40%"><font face="Arial">Square
inches
<input name="size" size="5" maxlength="8"
readonly>
</font></td>
</tr>
<tr>
<td colspan="4" height="11"><img src="images/
a5.jpg"></td>
</tr>
<tr>
<td width="12%"><img src="images/num_5.gif"
width="47" height="48"></td>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,961
Messages
2,570,130
Members
46,689
Latest member
liammiller

Latest Threads

Top