I was wondering is anyone could help me urgently with a problem i’m having with receiving form values from another form. The values are being sent but for some reason unknown to me they are shown on the page.
The code i have so far for the first page is:
<form type=”get” action=”passing-values-source.html”>
<td width=”100%” align=”left” valign=”middle” bgcolor=”#FFFFFF”> <table width=”100%” border=”0″ cellspacing=”0″ cellpadding=”4″ bgcolor=”#FFFFFF”>
<tr valign=”middle”>
<td width=”30%” align=”right” valign=”top” nowrap> <a class=”order”>Product:
</a></td>
<td width=”70%” valign=”top”> <textarea name=”product” rows=4 wrap=nowrap cols=40 value””></textarea>
</td>
</tr>
<tr valign=”middle”>
<td width=”30%” nowrap align=”right” valign=”top”><a class=”order”>
Size<font face=”Verdana, Arial, Helvetica, sans-serif” size=”1″ color=”#000000″>
(if applicable)</font>:</a></td>
<td width=”70%”> <input maxlength=50 size=30 name=”size” value=””> </td>
</tr>
<tr valign=”middle”>
<td width=”30%” nowrap align=”right”> <a class=”order”>Price:</a> </td>
<td width=”70%”><input type=”text” name=”price” value=”0.00″> </td>
</tr>
<tr>
<td width=”30%” nowrap align=”right” valign=”top” class=small> <a class=”order”>Quantity:</a>
</td>
<td width=”70%” valign=”top”><input type=”text” name=”quantity” value=”1″>
</td>
</tr>
<tr>
<td><img src=”blank.gif” height=”10″> </td>
<td><img src=”blank.gif” height=”10″> </td>
</tr>
<tr>
<td align=”center” valign=”middle”> <input type=”submit” class=”button” value=”Submit” name=”submit”>
</td>
<td align=”center” valign=”middle”> <input class=”button” type=”reset” value=”Reset” name=”reset”>
</td>
</tr>
</form>
The code for the page recieving the info goes something like:
<head>
<script>
<!– Begin
function getParams() {
var idx = document.URL.indexOf(‘?’);
var params = new Array();
if (idx != -1) {
var pairs = document.URL.substring(idx+1, document.URL.length).split(‘&’);
for (var i=0; i<pairs.length; i++) {
nameVal = pairs[i].split(‘=’);
params[nameVal[0]] = nameVal[1];
}
}
return params;
}
params = getParams();
// End –>
function round_total (c) {
var pennies = c * 100;
pennies = Math.round(pennies);
var strPennies = “” + pennies;
var len = strPennies.length;
return parseFloat(strPennies.substring(0, len – 2) + “.” + strPennies.substring(len – 2, len));
}
tax = 0.40;
delivery_p = 5.99;
var odate = new Date();
var qty = form.quantity.value;
var sze = form.size.value;
var product_v = “product”;
var total_price = price.value;
var price_without_tax = round_total(qty * total_price);
var ttax = round_total(price_without_tax * tax);
var delivery = round_total(qty * delivery_p);
var total_p = round_total(price_without_tax + ttax + delivery);
</script>
</head>
<body>
<SCRIPT LANGUAGE=”JavaScript”>
<!– Begin
product = unescape(params[“product”]);
size = unescape(params[“size”]);
price = unescape(params[“price”]);
quantity = unescape(params[“quantity”]);
document.writeln(“Product: ” + product_v + “<br>”);
document.writeln(“Quantity: ” + qty + “<br>”);
document.writeln(“Size: ” + sze + “<br>”);
document.writeln(“Price: £” + total_price + “<br>”);
document.writeln(“Tax: £” + ttax + “<br>”);
document.writeln(“Delivery: £” + delivery + “<br>”);
document.writeln(“Total: £” + total_p + “<br>”);
document.writeln(“Order placed on: ” + odate.toGMTString());
// End –>
</script>
</body>
Any suggestions?