Hello,
I have a form inside of the loop in a template so it shows up multiple times on a page, so I need to somehow distinguish which form was submitted in the entry information. After poking around on the forum I've come up with this. Sorry it's probably terrible – I'm not super great at PHP:
<?php
add_filter("gform_field_value_book", "populate_book");
function populate_book($value){
return get_the_title();
}
gravity_form(2, true, true);
?>
Which prepopulates a hidden field called book with the title of the post the form is part of. It works like a charm until the second post on the page, where there's a fatal PHP error that the populate_book function has already been defined.
There must be a way to do this, right? Am I going at it the wrong way?
Thanks so much for any help.