Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Question About Automatic Form submission

Posted on 2007-11-22
4
Medium Priority
?
533 Views
Last Modified: 2008-02-01
I have a custom shopping cart I developed that takes in items like memberships and products. The shopping cart adds the appropriate code if an item is a membership to make the billing on it recurring on the merchant end, when the form is submitted. I came accross a barrier, in which I found out my merchant services does not have specific fields for the recurring payments, which means that if I were to submit a charge total for memberships and products, and then send our a recurring command, the recurring charge would be for that whole amount, which is incorrect because I only want recurring to be for the memberships. Either way, I've set up my merchant service to redirect my clients to a custom php site, which resubmits another payment form if the client shopping cart had membership and products (the first submission would only submit the membership information, the second submission would submit the products. if there is no memberships, the first submission would submit all, the the second submission would be skipped). Here is the second payment form:

<form name="payment_form" action="DIRECTION TO MY MERCHANT" method="POST">
<input type="hidden" name="storename" value="MY STORE NUMBER">
<input type="hidden" name="chargetotal" value="'.$totaltwo.'">
<input type="hidden" name="txnorg" value="eci">
<input type="hidden" name="mode" value="payplus">
<input type="hidden" name="txntype" value="sale">
<input type="hidden" name="phone" value="'.$phone.'">
<input type="hidden" name="email" value="'.$email.'">
<input type="hidden" name="userid" value="'.$username.'">
<input type="hidden" name="cctype" id="cctype" value="'.$cctype.'">
<input type="hidden" name="cvm" id="cvm" value="'.$cccode.'">
<input type="hidden" name="bname" id="bname"value="'.$ccfullname.'">
<input type="hidden" name="cardnumber" id="cardnumber"value="'.$ccnumber.'">
<input type="hidden" name="expmonth" id="expmonth"value="'.$ccmonth.'">
<input type="hidden" name="expyear" id="expyear"value="'.$ccyear.'">
<input type="hidden" name="baddr1" id="baddr1"value="'.$ccaddress.'">
<input type="thidden" name="bcity" id="bcity"value="'.$cccity.'">
<input type="hidden" name="bstate" id="bstate"value="'.$ccstate.'">
<input type="hidden" name="bzip" id="bzip" maxlength="10"value="'.$cczipcode.'">
</form>

How do i go about submitting this form automatically?
0
Comment
Question by:jcbodyworks
4 Comments
 
LVL 15

Expert Comment

by:babuno5
ID: 20337588
depending on what event you want to submit the form
For example

 <form name="myform" action="sampleaction.php">
Search: <input type='text' name='query'>
<A href="javascript: submitform()">Search</A>
</form>
<SCRIPT language="JavaScript">
function submitform()
{
  document.myform.submit();
}
</SCRIPT>
0
 
LVL 2

Accepted Solution

by:
sujithcnair earned 2000 total points
ID: 20337600
window.document.formname.submit();
This will submit the form.
TO set the action
window.document.formname.action="somepage.php";
0
 
LVL 21

Expert Comment

by:nizsmo
ID: 20337706
<form name="payment_form" action="DIRECTION TO MY MERCHANT" method="POST">

just change this line's action tag to whatever file you want to submit to?
eg:
<form name="payment_form" action="paymentsubmit.php" method="POST">

also i realize that you have echoed the values using php variables, eg $cczipcode, or $ccstate, but you are missing the php tags, should be like this (for every line):
<input type="hidden" name="bstate" id="bstate"value="'<?php echo $ccstate; ?>'">

etc.. for every input tag.

hope this helps.
0
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 20337750
ofcourse, you can set the timer using javascript to submit automaticallly...
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article discusses how to implement server side field validation and display customized error messages to the client.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

927 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question