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

Pass Variables


  1. IFX
    Member

    Is there a way I can pass all of the variables from my submitted form to my redirect page? So basically it will take the variables, pass it to the redirect so I can say something like Thank you JOHN for your order....then populate a simple paypal buy now button?

    Posted 15 years ago #
  2. redityo

    Hi,

    Maybe this post can help you

    http://www.appnitro.com/forums/topic/custom-action-url-and-usage-field-data?replies=2#post-4093


    MachForm Support

    Posted 15 years ago #
  3. IFX
    Member

    Yeah, I saw that one. I just didn't know if there was a way to pass all variables easier instead of having to edit each form variable with code.

    Posted 15 years ago #
  4. redityo

    I see.. you can try this one, edit your "includes/post-functions.php" Try to search around line 939 ~ 951, you will see this code :

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

    replace with

    $url_data = '';
    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;
    	}
    
    	if (($form_id == 23) && ($key != 'date_created' && $key != 'ip_address')) {
    		//generate get variable
    		$url_data .= $key . '=' . $value . '&';
    	}
    }
    
    if ($form_id == 23) {
    if (!empty($url_data) && $url_data != '')
    	$url_data = substr($url_data,0,-1);
    	$process_result['form_redirect']  = "http://localhost:8888/test.php?" . $url_data;
    }

    The code will work for form 23 and redirect to "http://localhost:8888/test.php" with all element data on GET variable.


    MachForm Support

    Posted 15 years ago #
  5. mblackwood
    Member

    Has the code changed? My helper-functions.php file is only about 514 lines and does not contain this code. Perhaps it has been moved to another file?

    Posted 14 years ago #
  6. redityo

    Sorry, I mention the wrong filename, it should "post-functions.php" file, I've edited my previous post. Thank you.

    Otherwise you can use SESSION variable to pull out machform data into your redirect page, look at to this post for the method :

    http://www.appnitro.com/forums/topic/how-to-limit-access-to-redirect-page-after-submission?replies=13#post-3170


    MachForm Support

    Posted 14 years ago #
  7. cdixon
    Member

    i am trying to get the $url_data code above to work in version 3.3 of the software.
    I still check the redirect option in the form software, but it goes to that url rather than using the new code in the includes/post-functions.php.
    Can you give updated code for version 3.3?
    thanks

    Posted 11 years ago #

RSS feed for this topic

Reply