Forums

Fast Secure Contact Form
[resolved] Adding a custom hidden field via PHP (3 posts)

  1. surrealillusions
    Member
    Posted 1 year ago #

    Hi all,

    I'd like to know how you add a custom field to this plugin, via PHP, containing information from the WordPress loop.

    Essentially, a small form is displayed for each post and its excerpt on the page. It gives a user the ability to request more information about the post (in my case an activity, holiday or similar).

    I have this so far:

    <?php
    if ( isset($si_contact_form) ) {
    echo $si_contact_form->si_contact_form_short_code( array(
    'form' => '1',
    'hidden_field' => "$event_title",
    ) );
    }
    ?>

    Its the 'hidden_field' => "$event_title", part that I need to change to display a hidden input field. At the moment, the $event_title is the_title(); WP function, and it just displays that as text on the page, which isn't ideal :)

    Thanks.

    http://wordpress.org/extend/plugins/si-contact-form/

  2. Mike Challis
    Member
    Plugin Author

    Posted 1 year ago #

    See this help page
    http://www.fastsecurecontactform.com/shortcode-options

    But you have to properly translate this to the PHP code

    Here I add a hidden field called event_title

    <?php
    if ( isset($si_contact_form) ) {
    echo $si_contact_form->si_contact_form_short_code( array(
    'form' => '1',
    'hidden' => "event_title=$event_title",
    ) );
    }
    ?>

    FAQ
    http://www.fastsecurecontactform.com/faq

  3. surrealillusions
    Member
    Posted 1 year ago #

    Thanks for the reply.

    I've found a solution with the contactform7 plugin, but still, useful to know it is possible with this one too, as the code produced by contactform7 isn't the most pretty or accessible.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic