/    Sign up×
Community /Pin to ProfileBookmark

submitForm javascript not working

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&colon;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>
?>

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @TomUgro spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...