I've got some JS that I'm trying to have automatically run when the page loads, but I'm getting an 'object expected' error. The code also contains some PHP, which could be improperly formatted, causing the problem.
Anyone see what I'm doing wrong here?
Anyone see what I'm doing wrong here?
Code:
<html>
<head>
<script type="text/javascript" language="JavaScript">
<!--
function doSubmit()
{
document.frmprocess.notify_url.value="[URL unfurl="true"]http://www.test.com/ipn/ipn_res.php";[/URL]
document.frmprocess.cmd.value="_xclick";
document.frmprocess.business.value="test@test.com";
document.frmprocess.undefined_quantity.value="1";
<? echo ("document.frmprocess.item_name.value='" . $title . "'");
echo ("document.frmprocess.item_number.value='" . $agid . "'");
echo ("document.frmprocess.amount.value='" . $price . "'"); ?>
document.frmprocess.currency_code.value="USD";
document.frmprocess.no_shipping.value="1";
document.forms['frmprocess'].elements['return'].value="[URL unfurl="true"]http://www.test.com/ipn/thank_you.php";[/URL]
document.frmprocess.no_note.value="1";
document.frmprocess.lc.value="US";
document.frmprocess.rm.value="1";
document.frmprocess.method="post";
document.frmprocess.action="[URL unfurl="true"]https://www.paypal.com/cgi-bin/webscr";[/URL]
document.frmprocess.target="_blank";
document.frmprocess.submit();
}
window.close();
//-->
</script>
</head>
<body onLoad="doSubmit();">
<form name="frmprocess" action="" method="">
<input type="hidden" name="notify_url" value="">
<input type="hidden" name="cmd" value="">
<input type="hidden" name="business" value="">
<input type="hidden" name="undefined_quantity" value="">
<input type="hidden" name="item_name" value="">
<input type="hidden" name="item_number" value="">
<input type="hidden" name="amount" value="">
<input type="hidden" name="no_shipping" value="">
<input type="hidden" name="return" value="">
<input type="hidden" name="no_note" value="">
<input type="hidden" name="currency_code" value="">
<input type="hidden" name="lc" value="">
<input type="hidden" name="rm" value="">
</form>
</body>
</html>