• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: $_POST function not working for Data Array?

$_POST function not working for Data Array? 10 years 7 months ago #28780

Dear RSJoomla,

after struggeling for hours now i can't get this thing working so i wanted to ask if i can make it work with RSForm Pro to post data to an other url (external) and use a data array for that that gets filled with data of the form.

The example, i use a form with name and email field and a field where the user can fill in there amount, i want to use the name and email for the url but the amount inside of the data array is not getting trough.

if($_POST['form']['user_amount'] != ''){
$aantal = $_POST['form']['user_amount'];
} else {
$aantal = '1250';
}
 
## Request an External link
$ch = curl_init();
$data = array(
'user_api_key' => 'KEY IS HERE',
'user_id' => 'IDNUMBER IS HERE',
'user_reference_key' => 'OTHER DIGIT KEY HERE',
'amount_cents' => $aantal,
'remark' => 'Aantal',
'webhook_notification_url' => 'http://mywebsite/index.php?option=com_rsform&formId=6',
'on_topup_success_url' => 'http://mywebsite/success',
'on_topup_failure_url' => 'http://mywebsite/failure'    
);
curl_setopt($ch, CURLOPT_URL, 'https://external url to post to');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));   
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
$json_response = curl_exec($ch);
 
// get link 
$response_obj = json_decode($json_response);
$exterlink = $response_obj->{'exterlink'}; 
 
## Redirect the user to external page

// Order is significant here. Name first, Email as second parameter:
 
$data = array(
'name' => $_POST['form']['name'], 
'email' => $_POST['form']['emailadres']
);
 
header('Location: ' . $exterlink . "?" .  http_build_query($data));

The problem is that the 'amount_cents' => $aantal, is not getting filled. Please help me to make this work because i can't find a solution for it on the forum or in documentation also.

Thanks for the answer in advance.

With kind regards,

Dave
Last Edit: 10 years 7 months ago by dcp_designs. Reason: Code added
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!