Solved

Question About Automatic Form submission

Posted on 2007-11-22
4
527 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

635 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