Solved

Question About Automatic Form submission

Posted on 2007-11-22
4
523 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 500 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
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…

785 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