This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

Send form data to http POST/GET URL


  1. browncom
    Member

    Is it possible to send the form data to a HTTP POST/GET URL instead of to an email address upon submit?

    i.e.
    http://www.domain.com/formhandler.php?first_name=John&Last_Name=Doe

    Posted 15 years ago #
  2. redityo

    Hi,

    Do you want to redirect form after submit process, with URL GET data on it? to do so you should edit your "include/post-functions.php". In this example I assume you are using form ID = 2, In line 939 ~ 951 You will see these code :

    foreach ($table_data as $key=>$value){
    
    	if($value == ''){ //don't insert blank entry
    		continue;
    	}
    	$value		    = mysql_real_escape_string($value);
    	$field_list    .= "<code>$key</code>,";
    	$field_values  .= "'$value',";
    
    	if(!empty($value)){
    		$has_value = true;
    	}
    }

    replace it with this one

    foreach ($table_data as $key=>$value){
    
    	if($value == ''){ //don't insert blank entry
    		continue;
    	}
    	$value		    = mysql_real_escape_string($value);
    	$field_list    .= "<code>$key</code>,";
    	$field_values  .= "'$value',";
    
    	if ($key != 'ip_address' && $key != 'date_created')
    	$url_data .= $url_data  .  $key . '=' .$value .'&';
    
    	if(!empty($value)){
    		$has_value = true;
    	}
    }
    
    if ($form_id == '2')
    {
    	if ($url_data != '')
    		$process_result['form_redirect'] = "http://www.domain.com/handler.php?" . substr($url_data,0,-1);
    }

    if you are using page review, you should add some code again :

    1. add this code around line 970, exactly bellow this code if(!empty($form_review)){

    if (!empty($process_result['form_redirect']))
    		$_SESSION['url_data'] = $process_result['form_redirect'];

    2. Around line 2191, exactly bellow this code :

    $esr_plain_text	= $row['esr_plain_text'];

    add this code

    if (isset($_SESSION['url_data']) && !empty($_SESSION['url_data']) && $form_id = '2')
    {
    	$form_redirect = $_SESSION['url_data'];
    }

    MachForm Support

    Posted 15 years ago #

RSS feed for this topic

Reply