Title: Adding
Last modified: February 3, 2022

---

# Adding

 *  Resolved [BrightSpark](https://wordpress.org/support/users/brightspark/)
 * (@brightspark)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/adding-7/)
 * Hi Aurovrata
 * I’ve created a page where someone chooses a hotel, adds guests and their preferences,
   however for some reason I can’t get the email to include the room type (single,
   double, twin). I’ve tried it as a dropdown, checkbox, and radio button option.
   
   ______________________
 * The mail message returns the following:
 * Guests:
 * Guest Name Room Type Arrival Date Checkout Date
    Benny 2022-03-16 2022-03-19 
   Blu 2022-03-17 2022-03-20` ______________________
 * Mail message contains this code:
    Guests: [cf7sg-form-badminton-3] ______________________
 * The functions.php contains:
 *     ```
       add_filter( 'cf7sg_mailtag_cf7sg-form-badminton-3', 'filter_cf7_mailtag_cf7sg_form_badminton_3', 10, 3);
       function filter_cf7_mailtag_cf7sg_form_badminton_3($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('badminton-3'==$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>Room Type</th><th>Arrival Date</th><th>Checkout Date</th></tr></thead>
             <tbody>';
           if(!empty($submitted['guest-names'])){
             $style = 'style=[qtm]background-color:#e3e3e3[qtm]';
             $row=1;
             foreach($submitted['guest-names'] as $idx=>$guest){
               $tag_replace .='  <tr><td '.($row%2==0?$style:'').'>'.$guest.'</td><td '.($row%2==0?$style:'').'>'.$array ['room-type'][$idx]. '</td><td '.($row%2==0?$style:'').'>'.$submitted['arrival-date'][$idx]. '</td><td '.($row%2==0?$style:'').'>'.$submitted['checkout-date'][$idx]. '</td></tr>'.PHP_EOL;
               $row++;
             }
           }
           $tag_replace .='
             </tbody>
           </table>
           ';
         }
         return $tag_replace;
       }
       ```
   
 * ______________________
 * On another topic is there a way to add taking payments for their choice?
 * Thanks for any assistance you may be able to point me at.
 * Nick 🙂
    -  This topic was modified 4 years, 3 months ago by [BrightSpark](https://wordpress.org/support/users/brightspark/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fadding-7%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Aurovrata Venet](https://wordpress.org/support/users/aurovrata/)
 * (@aurovrata)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/adding-7/#post-15323547)
 * > dropdown, checkbox, and radio button option.
 * these are all array data submissions. Are you saying the array is empty each 
   time?
 * Have you tried inserting the field mail tag directly into your mail to see if
   it works?
 * > add taking payments
 * what is a “taking payment”?
 *  Thread Starter [BrightSpark](https://wordpress.org/support/users/brightspark/)
 * (@brightspark)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/adding-7/#post-15324932)
 * Hi Aurovrata
    Thanks for your speedy reply. Yes, when I add a couple of guests
   it shows blank for room type. However, if I add the [room-type] code at the bottom
   of the email the data is shown as:
 * row(1):single
    row(2):double
 *  Thread Starter [BrightSpark](https://wordpress.org/support/users/brightspark/)
 * (@brightspark)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/adding-7/#post-15324937)
 * add taking payments
 * Means can we link it up to an online payment system so customers may pay online?
 *  Plugin Author [Aurovrata Venet](https://wordpress.org/support/users/aurovrata/)
 * (@aurovrata)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/adding-7/#post-15340695)
 * > Yes, when I add a couple of guests it shows blank for room type.
 * I will check on my server and revert back.
 * > Means can we link it up to an online payment system so customers may pay online?
 * sure, there are multiple payment plugin extensions for cf7. Have you tried any?
 *  Plugin Author [Aurovrata Venet](https://wordpress.org/support/users/aurovrata/)
 * (@aurovrata)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/adding-7/#post-15454695)
 * so I finally got time to take a look at this and found the normal dropdown menu/
   checkbox to work just fine within a table and is reflected in the `$submitted`
   data passed to the filter.
 * however, you are trying to retrieve your `room-type` from an array object `$array`
   which is likely undefined…
 *     ```
       if(!empty($submitted['guest-names'])){
             $style = 'style=[qtm]background-color:#e3e3e3[qtm]';
             $row=1;
             foreach($submitted['guest-names'] as $idx=>$guest){
               $tag_replace .='  <tr><td '.($row%2==0?$style:'').'>'.$guest.'</td><td '.($row%2==0?$style:'').'>'.$array ['room-type'][$idx]. '</td><td '.($row%2==0?$style:'').'>'.$submitted['arrival-date'][$idx]. '</td><td '.($row%2==0?$style:'').'>'.$submitted['checkout-date'][$idx]. '</td></tr>'.PHP_EOL;
               $row++;
             }
           }
       ```
   
 * your `room-type` would be available in the `$submitted` object,
 *     ```
       $submitted['room-type']
       ```
   
    -  This reply was modified 4 years, 2 months ago by [Aurovrata Venet](https://wordpress.org/support/users/aurovrata/).

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Adding’ is closed to new replies.

 * ![](https://ps.w.org/cf7-grid-layout/assets/icon-256x256.png?rev=1834229)
 * [Smart Grid-Layout Design for Contact Form 7](https://wordpress.org/plugins/cf7-grid-layout/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cf7-grid-layout/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cf7-grid-layout/)
 * [Active Topics](https://wordpress.org/support/plugin/cf7-grid-layout/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cf7-grid-layout/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cf7-grid-layout/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Aurovrata Venet](https://wordpress.org/support/users/aurovrata/)
 * Last activity: [4 years, 2 months ago](https://wordpress.org/support/topic/adding-7/#post-15454695)
 * Status: resolved