Appnitro Software Forums » MachForm

POST values

(2 posts)

  1. antoine
    Member

    Is it possible to POST values to another PHP script after validation like using the redirect page feature ?

    Posted 3 years ago #
  2. With some modification, it is possible to do a POST request to another script.

    First you will need to download HttpClient class from here:
    http://scripts.incutio.com/httpclient/HttpClient.class.php

    Upload it into your machform/lib folder.

    Then edit your includes/post-functions.php file, search around line 1175 for this:

    if(empty($error_elements) && empty($process_result['custom_error'])){
    	$process_result['status'] = true;

    right below those lines, add this block of code:

    if($form_id == 482){
    	$target_url = 'http://www.example.com/your_post_target.php';
    
    	$target_data['custom_var_1'] 		= $table_data['element_1'];
    	$target_data['custom_var_2'] 		= $table_data['element_2'];
    	$target_data['custom_var_3'] 		= $table_data['element_3'];
    	$target_data['custom_var_4'] 		= $table_data['element_4'];
    
    	require 'lib/HttpClient.class.php';
    
    	$pageContents = HttpClient::quickPost($target_url, $target_data);
    
    	echo $pageContents;
    	exit;
    }

    make sure to adjust form_id, target_url, custom_var and element_id above with your own form values.

    More info about HttpClient:
    http://scripts.incutio.com/httpclient/

    Posted 3 years ago #

RSS feed for this topic

Reply

You must log in to post.