Adding PHP to hidden field
-
Hi,
We are using FS Contact 4.0.39.
I have a form where I have added a hidden field: page_address. I want to use PHP code to fill in the value for that hidden field. I found this page: http://www.fastsecurecontactform.com/shortcode-options which shows how to do this. But it isn’t working for me.
I have added this code to the template file:
<?php if ( isset($si_contact_form) ) { echo $si_contact_form->si_contact_form_short_code( array( 'form' => '2', 'page_address' => "$location_string", ) ); } ?>But nothing show up, no form at all. If I add this code:
echo do_shortcode("[si-contact-form form='2' hidden='page_address=".$location_string . "']");The form displays but the hidden field that I added called page_address has a value of “”. But there is another hidden field called page_address after the submit button that has the value set to the address in $location_string. I need to be able to pass the page_address field to MailChimp, so I need the hidden field I setup to have the address in it. I then tried this code:
echo do_shortcode("[si-contact-form form='2' page_address='".$location_string . "']");But my hidden page_address field is still “” and no page_address hidden field after the submit.
The check for $si_contact_form being set must be failing in the template, so do I need to set it somehow in the template to use the PHP code from the Tip? How do I get my page_address hidden field to have the address in it?
Thank you.
The topic ‘Adding PHP to hidden field’ is closed to new replies.