Multiple Contact Form 7 forms of the same id/form on the same page returning different names/id depending on which link is clicked

So I have a custom WordPress template that is returning a set of 20 search results I then have a button on each result that opens the Contact 7 Form in a lightbox when clicked.

Depending on which record’s button is clicked I want it to return that records id/name in a hidden field to the email sent from the contact form.

Read More

I was hoping to do something like adding another attribute to the Contact 7 Form Shortcode as in

<?php echo do_shortcode('[formlightbox title="Arrange a Viewing" text="Click to Book Viewing"][contact-form-7 id="655" title="Arrange a Viewing" record_id="'. $rmf->id .'"][/formlightbox]'); ?>

However I’m not at all sure how to pull the attribute (record_id) that I’ve placed in the Contact Form 7 shortcode so that it will show up in the sent email.

I’m open to other suggestions provided I can reuse the same contact 7 form/id and have multiple links to the same form that return different record/name ids when submitted off the same page.

Thanks for taking the time to look through my question!

Related posts

Leave a Reply