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

variables on the success page?


  1. spookynutz
    Member

    Is there a way to use form variables on the success page? Like, "Success! An e-mail has been sent to {element_7}

    Posted 15 years ago #
  2. redityo

    Hi,

    You can add a session variable to your form, to do that you should edit 2 files, "includes/post-functions.php" and "includes/view-function.php". In my example I assume you will get data from element_1 in form 2, Here is the details :

    1. Edit post-functions.php, search around line 939 ~ 950 you will find 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 with

    $_SESSION['success_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 ($key == 'element_1' && $form_id  == '2')
    	{
    		$_SESSION['success_data'] = $value;
    	}
    
    	if(!empty($value)){
    		$has_value = true;
    	}
    }

    2. Edit "view-functions.php", search around line 2243 you will see this code

    <h2>{$form->success_message}</h2>

    replace with

    <h2>{$form->success_message}  {$_SESSION['success_data']}</h2>

    make sure you have adjust form ID and element ID with yours.


    MachForm Support

    Posted 15 years ago #
  3. frungimi
    Member

    how can we show all the info submitted?

    Posted 15 years ago #

RSS feed for this topic

Reply