I'm a newbie (obviously) and can't figure out why the JS code is not be execited. Any ideas??
Thanks!
<html>
<head>
<script language="JavaScript">
<!-- // ignore if non-JS browser
function validator(theform)
{
var error = "";
var digits = "0123456789";
if (theform.dd.options[0].selected == true)
{
error += "Please select product from the dropdown list.\n";
}
if (theform.quantity.value == "")
{
error += "Please fill in numeric quantity.\n";
}
for (var i = 0; i < theform.quantity.value.length; i++)
{
temp = theform.quantity.value.substring(i, i+1)
if (digits.indexOf(temp) == -1 &&
theform.number.value != "")
{
error += "The quantity must be numeric.\n";
break;
}
}
if (error != "")
{
alert(error);
return (false);
}
}
// -->
</script>
<title>Order Form</title>
</head>
<body>
<?
echo '<form target="_open" action="https://www.paypal.com/cgi-bin/webscr" method="POST" onSubmit="return validator(this);"> ';
echo '<input type="text" name="quantity" size="3" value=http://www.webdeveloper.com/forum/archive/index.php/"" ><font size="1"> Qty <br>';
echo '<br>';
echo "<select size=\"1\" name=\"dd\">";
echo "<option value=http://www.webdeveloper.com/forum/archive/index.php/1>".stripslashes($row["price1"])."</option>";
echo "<option value=2>".stripslashes($row["price2"])."</option></select> ";
echo "<font size=\"1\"><button name=\"B3\">Add to Cart</font></button>";
echo "<input type=\"hidden\" name=\"item_name\" value=".stripslashes($row["prod_name"]).">";
if($selection =='1'){
echo "<input type=\"hidden\" name=\"amount\" value=http://www.webdeveloper.com/forum/archive/index.php/".stripslashes($row["price1"]).">";
}
elseif($selection =='2')
{
echo "<input type=\"hidden\" name=\"amount\" value=http://www.webdeveloper.com/forum/archive/index.php/".stripslashes($row["price2"]).">";
}
echo'</form>';
?>
</body>
</html>
Thanks!
<html>
<head>
<script language="JavaScript">
<!-- // ignore if non-JS browser
function validator(theform)
{
var error = "";
var digits = "0123456789";
if (theform.dd.options[0].selected == true)
{
error += "Please select product from the dropdown list.\n";
}
if (theform.quantity.value == "")
{
error += "Please fill in numeric quantity.\n";
}
for (var i = 0; i < theform.quantity.value.length; i++)
{
temp = theform.quantity.value.substring(i, i+1)
if (digits.indexOf(temp) == -1 &&
theform.number.value != "")
{
error += "The quantity must be numeric.\n";
break;
}
}
if (error != "")
{
alert(error);
return (false);
}
}
// -->
</script>
<title>Order Form</title>
</head>
<body>
<?
echo '<form target="_open" action="https://www.paypal.com/cgi-bin/webscr" method="POST" onSubmit="return validator(this);"> ';
echo '<input type="text" name="quantity" size="3" value=http://www.webdeveloper.com/forum/archive/index.php/"" ><font size="1"> Qty <br>';
echo '<br>';
echo "<select size=\"1\" name=\"dd\">";
echo "<option value=http://www.webdeveloper.com/forum/archive/index.php/1>".stripslashes($row["price1"])."</option>";
echo "<option value=2>".stripslashes($row["price2"])."</option></select> ";
echo "<font size=\"1\"><button name=\"B3\">Add to Cart</font></button>";
echo "<input type=\"hidden\" name=\"item_name\" value=".stripslashes($row["prod_name"]).">";
if($selection =='1'){
echo "<input type=\"hidden\" name=\"amount\" value=http://www.webdeveloper.com/forum/archive/index.php/".stripslashes($row["price1"]).">";
}
elseif($selection =='2')
{
echo "<input type=\"hidden\" name=\"amount\" value=http://www.webdeveloper.com/forum/archive/index.php/".stripslashes($row["price2"]).">";
}
echo'</form>';
?>
</body>
</html>