We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8168
    • 1,118 Posts
    Hi guys,

    I am looking to pass some PHP Vars from a snippet to a chunk - what am I doing wrong...

    Snippet code:

    $ClientArray = array(
        $briefing_yourname => $briefing_yourname
    );
    $message2 = $modx->getChunk('EMAIL_BriefingForm_Client', '$ClientArray');
    


    So, I have a var in the snippet called $briefing_yourname that gets the value of a form field, I want to pass the value of that form field in the $briefing_yourname PHP var to the chunk "EMAIL_BriefingForm_Client", so that where I use the $briefing_yourname in the chunk, it reads in the form field value...

    What am I doing wrong here?

    Cheers


    dubbs.

    This question has been answered by dubbs. See the first response.

    • discuss.answer
      • 8168
      • 1,118 Posts
      OK - Solved it - this is the correct format:

      $message = $modx->getChunk('EMAIL_BriefingForm_Client', array(
               'briefing_yourname' => $briefing_yourname
      ));
      


      Then in Chunk use:

      [[+briefing_yourname]]