Solved

Question About Automatic Form submission

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
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 how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

896 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now