Hello everyone!
I’m hoping someone can help. This is a scipt that was written to take an html form, email it to someone and then using javascript send the information to Paypal for processing.
I don’t understand php or javascript very well and am really hoping some genius can help me. When I try to run this on my server I first get php syntax errors. Then if I get that worked out the javascript simply doesn’t work. There is no redirect. The email feature is working fine though. ?
Here is the code for the php containing the javascript that is not working.
[CODE]
<?php
//set the email address here.
//example
//$email = “[email protected]”;
$email = “[email protected]”;
//set the email subject line here.
//example
//$subject = “Order”;
$subject = “Order”;
// next, loop through the $_POST array, set $message = to the values of the array and a newline for formatting.
foreach($_POST as $key => $value) { $message .= $value.”n”; }
//send the email
mail($email, $subject, $message); $os0 = $_POST[‘holder’]; –>
//now, create a webpage page and dynamically submit the PayPal form with Javascript –>
<html>
<head>
<script language=”JavaScript” type=”text/javascript”>
<!–
function submitForm() {
document.myForm.submit();
setTimeout(‘self.close();’,10000);
}
//–>
</script>
</head>
<body onLoad=”javascript:submitForm()”>
You are being redirected to PayPal. This window will close itself in 10 seconds.
<form name=”myForm” method=”post” action=”https://www.paypal.com/cgi-bin/webscr” target=”_blank”>
<input type=”hidden” name=”business” value=”[email protected]”>
<input type=”hidden” name=”cmd” value=”_xclick”>
<input type=”hidden” name=”item_name” value=”test”>
<input type=”hidden” name=”amount” value=”12.00″>
<input type=”hidden” name=”on0″ value=”Variables”>
<input type=”hidden” name=”os0″ value=”<? echo $os0 ?>”>
<!–pass along the information collected –>
</form>
</body>
</html>
?>