Solved

Question About Automatic Form submission

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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…
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.

746 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

13 Experts available now in Live!

Get 1:1 Help Now