473,406 Members | 2,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

RePOSTing form data

6
Hi folks,

I am working on a registration form that records its data in a database on our Web site then forwards the user to another site's page where fee processing occurs. The other site's page uses POST data from my form to populate its fields and records.

How do I get my site to send POST data again to the other site after the user has already clicked the Submit button on my end and it has been sent to one of my pages for processing?

Thanks in advance!
Mar 11 '08 #1
11 5855
Markus
6,050 Expert 4TB
You could populate some hidden inputs in a form with the post data, then send the form to the other website.
Mar 11 '08 #2
Must say I don't clearly understand your situation

Do you control the other site?
Are you reffering to the customer filling out your form, submitting, then leaving your site to go to a site you do not control, then comming back and having the info?

If the second scenario is closer to your situation, I would store all the post variables into session vars, then on any page you want you can check if they are set, and prepoulate either hidden (as stated above) or visible fields with their values.
Mar 11 '08 #3
dbws
6
You could populate some hidden inputs in a form with the post data, then send the form to the other website.
How do you get the hidden inputs to resubmit without requiring a user to click on a Submit button?
Mar 11 '08 #4
dbws
6
Must say I don't clearly understand your situation

Do you control the other site?
Are you reffering to the customer filling out your form, submitting, then leaving your site to go to a site you do not control, then comming back and having the info?

If the second scenario is closer to your situation, I would store all the post variables into session vars, then on any page you want you can check if they are set, and prepoulate either hidden (as stated above) or visible fields with their values.
Hi RoninOni.

The assumption here is that two sites are controlled by two different parties: our Web site is controlled by me and the payment processing site is controlled by a known corporation.

I have had no problem sending POST data to the site and receiving POSTBACK data. The problem is with being able to process the data and send the same data to the external site. To process my data, a user clicks the Submit button and the POST data is sent to the page specified in the action of the form tag. My question is how do I take the same data from the page the data is sent to and send it to the external site as POST data without requiring a user to click another Submit button?

Would session variables work with the external site as well? Or would that require the external site coding their page to accept session variables instead of POST variables? (Is there a difference?)

Many thanks!
Mar 11 '08 #5
Markus
6,050 Expert 4TB
How do you get the hidden inputs to resubmit without requiring a user to click on a Submit button?
You could use javascript :)

Expand|Select|Wrap|Line Numbers
  1. formname.submit()
  2.  
Mar 11 '08 #6
dbws
6
You could use javascript :)

Expand|Select|Wrap|Line Numbers
  1. formname.submit()
  2.  
Is there a way to do this without Javascript?

Thanks!
Mar 11 '08 #7
TheServant
1,168 Expert 1GB
Is there a way to do this without Javascript?

Thanks!
OK, let's say your form page (user input) is called form.php
The processing file where the information initially gets sent is called info.php
The secondary processing file is called other.php

How does the other.php file accept variables? is it by POST? Maybe have an if statement in the form.php page which will test to see if a variable has been set by info.php (you can write at the bottom of info.php $info_sent = TRUE; and then test for it etc...) and have a hidden form (just a normal form with a single hidden field) that will refresh itself and automatically send the information?

Can I just ask, who is the information going to? You and...
Mar 12 '08 #8
dbws
6
OK, let's say your form page (user input) is called form.php
The processing file where the information initially gets sent is called info.php
The secondary processing file is called other.php

How does the other.php file accept variables? is it by POST? Maybe have an if statement in the form.php page which will test to see if a variable has been set by info.php (you can write at the bottom of info.php $info_sent = TRUE; and then test for it etc...) and have a hidden form (just a normal form with a single hidden field) that will refresh itself and automatically send the information?

Can I just ask, who is the information going to? You and...
Hi TheServant,

The information is going to a financial institution. Their page accepts POST data by having a form submit that information like this:

Expand|Select|Wrap|Line Numbers
  1. <form action="http://www.financialinstitution.com/processpayment" method="post">
But the problem is that I need to process the data on my site first like this:

Expand|Select|Wrap|Line Numbers
  1. <form action="process.php" method="post">
Both pages accept variables by POST. So, if I can do what you suggest (i.e., use a hidden form to send the information automatically after my processing has occurred), then that is the solution I need. But I do not know how to use a hidden form and automatically send the information *without* using Javascript. Do you have any suggestions?

Thanks in advance!
Mar 12 '08 #9
ronverdonk
4,258 Expert 4TB
Imagine the following process:
Expand|Select|Wrap|Line Numbers
  1.  1. Your form script:
  2.     - user fills in form
  3.     - user submit to your processing script
  4.  2. your processing script:
  5.     - save $_POST array in $your_array
  6.     - process the posted form
  7.     - build a cURL POST request with $your_array as POST
  8.     - submit cURL post request to financial institution    
  9.  3. Financial institution:
  10.     - process POSTed variables 
  11.  
Is this the process you want?

Ronald
Mar 12 '08 #10
dbws
6
Imagine the following process:
Expand|Select|Wrap|Line Numbers
  1.  1. Your form script:
  2.     - user fills in form
  3.     - user submit to your processing script
  4.  2. your processing script:
  5.     - save $_POST array in $your_array
  6.     - process the posted form
  7.     - build a cURL POST request with $your_array as POST
  8.     - submit cURL post request to financial institution    
  9.  3. Financial institution:
  10.     - process POSTed variables 
  11.  
Is this the process you want?

Ronald
Hi Ronald,

Yes! That is the process I am looking for.

What is a cURL POST? Can you point me to an example? In the meantime, I'll be checking the Web to see what it is and how to use it in this context.

Thanks again!
Mar 12 '08 #11
ronverdonk
4,258 Expert 4TB
See also CURL, Client Url Library Functions in the php documentation.

Following are 2 examples on how you can use cURL to POST data. The first one builds a string, like a url string. The second one posts the variables from an array. The latter can be used when you (in your POST processing script) just assign the $_POST array to your array.

1. Post a url-like stream
[php]
<?php
// POST a stream via cURL

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,"http://www.mysite.com/tester.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
"postvar1=value1&postvar2=value2&postvar3=value3") ;
curl_exec ($ch);
curl_close ($ch);
?>
[/php]2. Here you POST an array (like you have) via cURL[php]
<?php
// ------------ POST an array via curl -----------------------

// create a new curl resource
$ch = curl_init();

// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://path/to/your/page.php");
$id=111; $code='ABCD';

// Build the test array
$data=array( 'id'=>$id, 'code'=>'$code');

// Do a POST
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

// grab URL, and print
curl_exec($ch);

?>[/php]Ronald
Mar 12 '08 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Citoyen du Monde | last post by:
Trying to get some ideas on a simple javascript project (to teach myself the language). I want to develop a client-side vocabulary practice application that would allow users to enter their own...
6
by: Hamed | last post by:
Hello I have employed as a developer in a software company that its team uses FoxPro / VB 6.0 / VC++ 6.0 as the developing tools and newly is going to migrate to VS.NET. There is a project...
10
by: Gregory A Greenman | last post by:
I'm trying to write a program in vb.net to automate filling out a series of forms on a website. There are three forms I need to fill out in sequence. The first one is urlencoded. My program is...
2
by: Monica Roman | last post by:
Hello all, I have an Access database linked to SQL Server tables and Views. When I upsized the Access tables all the yes/no fields remained the same, i.e., I see a check mark or not. When I...
21
by: John Welch | last post by:
Sometimes I post a question here and someone answers it quickly with an answer like "well, I don't know much about this, but maybe such and such." While I completely appreciate their effort, I...
4
by: AMeador | last post by:
I have a form that should come up blank (no data in the text boxes, etc...). I want the user to be able to fill in the contols on the form and then save the data to a SQL Server database. My plan...
0
by: Asif Mohammed | last post by:
Hello, I have a datagridview bound to a database table with 2 columns. One is an ID column "NameID" which is hidden, the other is called "Name". The schema picture is here :...
8
by: hoofbeats95 | last post by:
I don't think this should be this complicated, but I can't figure it out. I've worked with C# for several years now, but in a web environment, not with windows form. I have a form with a query...
22
by: Zytan | last post by:
I have public methods in a form. The main form calls them, to update that form's display. This form is like a real-time view of data that is changing. But, the form may not exist (it is...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.