• Resolved BrightSpark

    (@brightspark)


    I’m using Smart Grid-Layout Design for Contact Form 7 to send booking info for multiple guests. Most of the data comes through email except the guest info for activities that they have selected. In the table, it just says ‘Array’.

    I suspect I need to add extra code to the functions.php file. However, I’m not sure what that should be. Here is the code I’m currently using, and I would be grateful for any assistance. Thank you.

    /**
    
    * Center Parcs contact form
    
    */
    
    add_filter( 'cf7sg_mailtag_cf7sg-form-center-parcs', 'filter_cf7_mailtag_cf7sg_form_center_parcs', 10, 3);
    
    function filter_cf7_mailtag_cf7sg_form_center_parcs($tag_replace, $submitted, $cf7_key){
    
    /*the $tag_replace string to change*/
    
    /*the $submitted an array containing all submitted fields*/
    
    /*the $cf7_key is a unique string key to identify your form, which you can find in your form table in the dashboard.*/
    
    if('center-parcs'==$cf7_key ){
    
    $style = 'style="padding:0 3px;border-collapse:collapse;border-bottom:1px solid black[qtm]';
    
    $tag_replace ='
    
    <table>
    
    <thead><tr><th>Guest Name</th><th>Arrival Date</th><th>Checkout Date</th><th>Lodge Type</th><th>Room Type</th><th>Activities</th></tr></thead>
    
    <tbody>';
    
    if(!empty($submitted['Guest'])){
    
    $style = 'style=[qtm]background-color:#e3e3e3[qtm]';
    
    $row=1;
    
    foreach($submitted['Guest'] as $idx=>$guest){
    
    $tag_replace .=' <tr><td '.($row%2==0?$style:'').'>'.$guest.'</td><td '.($row%2==0?$style:'').'>'.$submitted['Checkindate'][$idx]. '</td><td '.($row%2==0?$style:'').'>'.$submitted['Checkoutdate'][$idx]. '</td><td '.($row%2==0?$style:'').'>'.$submitted['lodge-type'][$idx]. '</td><td '.($row%2==0?$style:'').'>'.$submitted['room-type'][$idx]. '</td><td '.($row%2==0?$style:'').'>'.$submitted['Activities'][$idx]. '</td></tr>'.PHP_EOL;
    
    $row++;
    
    }
    
    }
    
    $tag_replace .='
    
    </tbody>
    
    </table>
    
    ';
    
    }
    
    return $tag_replace;
    
    }

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author Aurovrata Venet

    (@aurovrata)

    In the table, it just says ‘Array’.

    Indeed because there are multiple values which you must explicitly list out. You will need to loop over that array value and display each value.

Viewing 1 replies (of 1 total)
  • The topic ‘sending multi selected checkbox data to mail recipient’ is closed to new replies.