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

Add parameter to advanced embed code


  1. elvar
    Member

    Hi,

    I found the topic about uri parameters in machform and it is very understandable. Super component and super support.

    However I have some UTF problems in the uri parameters and I want to solve it with advanced php embed code (till now I never used normal view of the form - only embed).

    It is easy for me to encode and decode the uri parameters in php. But for doing that I need to easily just add new parameters.

    So, code will be like this:

    <?php
    require("/pathtomachform/machform.php");
    $mf_param['form_id'] = XXX;
    $mf_param['base_path'] = 'basepath';

    // add new parameter
    $mf_param['email'] = 'clientemail';

    display_machform($mf_param);
    ?>

    Where exactly I need to change the code in MachForm component to use new parameter (if exist) in the form email field?

    Thanks

    Posted 14 years ago #
  2. redityo

    Hi,

    Hmmm .. do you mean, you need to pass the parameter to email field from advance code ? If so, it's easier to use the SESSION variable for this. First you need to add session variable to your advance embed code like this

    <?php
    session_start();
    require("/pathtomachform/machform.php");
    $mf_param['form_id'] = XXX;
    $mf_param['base_path'] = 'basepath';
    
    // add new parameter
    //$mf_param['email'] = 'clientemail';
    $_SESSION['email_session'] = 'clientemail';
    
    display_machform($mf_param);
    ?>

    then edit "view-functions.php" and go to line 208, you'll find this code :

    $element_markup = <<<EOT

    put these code above that line

    if (!empty($_SESSION['email_session']) &&  empty($element->populated_value['element_'.$element->id]['default_value'])) {
    	$element->default_value = $_SESSION['email_session'];
    }

    MachForm Support

    Posted 14 years ago #

RSS feed for this topic

Reply