This topic is locked

cant get autosubmit to work

8/29/2011 7:10:25 AM
PHPRunner General questions
C
cleanroomdesign author

The information posts fine from paypal, but i cant get it to auto submit. tried numerous javascripts onsubmit()
Also i added the form- tried to autosubmit that way to no avail, so i think i can take the form out?

please help!
<?php
require_once "../store/paypal/utility.php";

require_once "../store/paypal/constants.php";
$url = "https://www.".DEFAULT_ENV.".paypal.com/cgi-bin/webscr";;

$postFields = "cmd=".urlencode("_notify-synch").

"&tx=".urlencode(htmlspecialchars($_GET["tx"])).

"&at=".urlencode(DEFAULT_IDENTITY_TOKEN);

$ppResponseAr = Utils::PPHttpPost($url, $postFields, true);
if(!$ppResponseAr["status"]) {

Utils::PPError($ppResponseAr["error_msg"], $ppResponseAr["error_no"]);

exit;

}
$httpParsedResponseAr = $ppResponseAr["httpParsedResponseAr"];
// assign posted variables to local variables

$item_name = $httpParsedResponseAr['item_name'];

$item_number = $httpParsedResponseAr['item_number'];

$receiver_email = $httpParsedResponseAr['receiver_email'];

$receiver_id = $httpParsedResponseAr['receiver_id'];

$quantity = $httpParsedResponseAr['quantity'];

$first_name = $httpParsedResponseAr['first_name'];

$last_name = $httpParsedResponseAr['last_name'];

$payer_email = $httpParsedResponseAr['payer_email'];

$txn_type = $httpParsedResponseAr['txn_type'];

$address_street = $httpParsedResponseAr['address_street'];

$address_city = $httpParsedResponseAr['address_city'];

$address_state = $httpParsedResponseAr['address_state'];

$address_zip = $httpParsedResponseAr['address_zip'];

$item_number = $httpParsedResponseAr['item_number'];

$option_name1 = $httpParsedResponseAr['option_name1'];

$option_selection1 = $httpParsedResponseAr['option_selection1'];

$option_name2 = $httpParsedResponseAr['option_name2'];

$option_selection2 = $httpParsedResponseAr['option_selection2'];

$invoice = $httpParsedResponseAr['invoice'];

$custom = $httpParsedResponseAr['custom'];

$payer_id =$httpParsedResponseAr['payer_id'];
?>

<html lang="en">

<head>

<title>Rec</title>

<link REL="stylesheet" href="include/style.css" type="text/css">

<!--[if IE]>

<link REL="stylesheet" href="include/styleIE.css" type="text/css">

<![endif]-->

<style>

center_block {width:50%;margin:0 auto;min-width:500px;}

contents_block {text-align:center;}

header_block {white-space:nowrap;height:25px;padding:0 10px 5px;text-align:center;}

fields_block {width:100%;margin:0;padding:10px}

header_block span {margin:0 5px}

buttons_block {padding:10px 10px 5px}

buttons_block div {padding:3px}

delimiter {margin:2px}

fields_block td {padding:3px 14px}

username_block td {padding-top:13px;white-space:nowrap;}

remember_block td {padding-bottom:13px;white-space:nowrap;}

required_block {text-align:left;padding:5px}

</style>

<!--[if IE]>

<style>

main_block {width:100%}

</style>

<![endif]-->

</head>

<body>

<script language="JavaScript" src="include/jquery.js"></script>
<script language="JavaScript" src="include/jsfunctions.js"></script>
<script language="JavaScript" src="include/runnerJS/RunnerBase.js"></script>
<form action="rec.php" method="post" id="rec" name="rec.php">
<table id="center_block" align="center">

<tr><td id="contents_block">
<div class="main_table_border2 loginshade" id="main_block">
<table cellpadding=0 cellspacing=0 border=0 id="fields_block" class="loginshade">
<tr id="email_fieldblock">

<td align=left width=50% class=loginshade>

<div align="left"><label for="value_email_1">Email:</label></div>

</td>

<td width=50% class=loginshade>

<span id="edit1_email_0" style="white-space: nowrap;"><input id="value_email_1" style="" type="text" name="value_email_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["payer_email"]) ?>">&nbsp;<font color="red"></font></span>

<div class="error"></div>

</td>

</tr>
<tr id="pass_fieldblock">

<td align=left width=50% class=loginshade>

<div align="left"><label for="value_pass_1">Pass:</label></div>

</td>

<td width=50% class=loginshade>

<span id="edit1_pass_0" style=""><input style="" id="value_pass_1" type="Password" name="value_pass_1" maxlength=50 value="1234">&nbsp;<font color="red">
</font></span>

<div class="error"></div>

</td>

</tr>
<tr id="confirm_block">

<td align=left width=50% class=loginshade>

<div align="left"><label for="value_confirm_1">Re-enter password:</label></div>

</td>

<td width=50% class=loginshade>

<span id="edit1_confirm_0" style=""><input style="" id="value_confirm_1" type="Password" name="value_confirm_1" value="1234">&nbsp;<font color="red"></font></span>

<div class="error"></div>

</td>

</tr>
<tr id="fname_fieldblock">

<td align=left width=50% class=loginshade>

<div align="left"><label for="value_fname_1">First Name:</label></div>

</td>

<td width=50% class=loginshade>

<span id="edit1_fname_0" style="white-space: nowrap;"><input id="value_fname_1" style="" type="text" name="value_fname_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["first_name"]) ?>">&nbsp;<font color="red">
</font></span>

</td>

</tr>
<tr id="lname_fieldblock">

<td align=left width=50% class=loginshade>

<div align="left"><label for="value_lname_1">Last Name:</label></div>

</td>

<td width=50% class=loginshade>

<span id="edit1_lname_0" style="white-space: nowrap;"><input id="value_lname_1" style="" type="text" name="value_lname_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["last_name"]) ?>">&nbsp;<font color="red"></font></span>

</td>

</tr>
<tr id="address_fieldblock">

<td align=left width=50% class=loginshade>

<div align="left"><label for="value_address_1">Address:</label></div>

</td>

<td width=50% class=loginshade>

<span id="edit1_address_0" style="white-space: nowrap;"><input id="value_address_1" style="" type="text" name="value_address_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["address_street"]) ?>">&nbsp;<font color="red">
</font></span>

</td>

</tr>
<tr id="city_fieldblock">

<td align=left width=50% class=loginshade>

<div align="left"><label for="value_city_1">City:</label></div>

</td>

<td width=50% class=loginshade>

<span id="edit1_city_0" style="white-space: nowrap;"><input id="value_city_1" style="" type="text" name="value_city_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["address_city"]) ?>">&nbsp;<font color="red"></font></span>

</td>

</tr>
<tr id="state_fieldblock">

<td align=left width=50% class=loginshade>

<div align="left"><label for="value_state_1">State:</label></div>

</td>

<td width=50% class=loginshade>

<span id="edit1_state_0" style="white-space: nowrap;"><input id="value_state_1" style="" type="text" name="value_state_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["address_state"]) ?>">&nbsp;<font color="red">
</font></span>

</td>

</tr>
<tr id="zip_fieldblock">

<td align=left width=50% class=loginshade>

<div align="left"><label for="value_zip_1">Zip:</label></div>

</td>

<td width=50% class=loginshade>

<span id="edit1_zip_0" style="white-space: nowrap;"><input id="value_zip_1" style="" type="text" name="value_zip_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["address_zip"]) ?>">&nbsp;<font color="red"></font></span>

</td>

</tr>
<tr id="cosponsor_fieldblock">

<td align=left width=50% class=loginshade>

<div align="left"><label for="value_cosponsor_1">Cosponsor:</label></div>

</td>

<td width=50% class=loginshade>

<span id="edit1_cosponsor_0" style=""><input id="type_cosponsor_1" type="hidden" name="type_cosponsor_1" value="checkbox">

<input id="value_cosponsor_1" type="checkbox" name="value_cosponsor_1" checked="checked" ></span>

</td>

</tr>
<tr id="recipients_fieldblock">

<td align=left width=50% class=loginshade>

<div align="left"><label for="value_recipients_1">Recipients:</label></div>

</td>

<td width=50% class=loginshade>

<span id="edit1_recipients_0" style="white-space: nowrap;"><input id="value_recipients_1" style="" type="text" name="value_recipients_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["quantity"]) ?>">&nbsp;<font color="red">
</font></span>

</td>

</tr>
<tr id="clients_fieldblock">

<td align=left width=50% class=loginshade>

<div align="left"><label for="value_clients_1">Clients:</label></div>

</td>

<td width=50% class=loginshade>

<span id="edit1_clients_0" style=""><input id="type_clients_1" type="hidden" name="type_clients_1" value="checkbox">

<input id="value_clients_1" type="checkbox" name="value_clients_1" checked="checked" ></span>

</td>

</tr>
<tr id="space_block"></tr>
</table>
</div>

</td></tr>

</table>

<input type=submit value="Submit" class=button id="saveButton1" onload="Submit"></form>

</body>

</html>

C
cgphp 8/29/2011

Remove onload="Submit" from the input submit tag and in the "Javascript OnLoad" event enter this code:

$("#rec").submit(); //where #rec is the id of your form tag