Title: Can fields be initialized with php code ?
Last modified: August 20, 2016

---

# Can fields be initialized with php code ?

 *  Resolved [supfred](https://wordpress.org/support/users/supfred/)
 * (@supfred)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/can-fields-be-initialized-with-php-code/)
 * Hello,
 * First of all, thanks a lot for your wonderful extension !
    I’ve searched for 
   one thing, but i can’t find any way do to this…
 * Can we embed php code in the config form ?
    for example, i’d like to sign the
   form with the name of my website, but not hard-coded ! with : <?php bloginfo(‘
   name’ );?>
 * Mainly, i’d like to initialise some field with php code too.
    would you have 
   a solution ?
 * I want to create a “send to friend” form, so i want to get the HTTP_REFERER var
   from PHP, and set it in a field of your form.
 * Tanks a lot for your response.
    Best regards, Fred.

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

 *  [Karesansui](https://wordpress.org/support/users/karesansui/)
 * (@karesansui)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/can-fields-be-initialized-with-php-code/#post-2233965)
 * Yes.
 * [http://sevenspark.com/wordpress/contact-form-7-dynamic-text-extension-released](http://sevenspark.com/wordpress/contact-form-7-dynamic-text-extension-released)
 * [http://tonykwon.com/2010/09/can-we-capture-http-referer-information-upon-form-submission-using-contact-form-7/](http://tonykwon.com/2010/09/can-we-capture-http-referer-information-upon-form-submission-using-contact-form-7/)
 * Enjoy, Piet
 *  Thread Starter [supfred](https://wordpress.org/support/users/supfred/)
 * (@supfred)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/can-fields-be-initialized-with-php-code/#post-2233973)
 * It looks great !
    Thanks for your response.
 * I finally add my own module of Contact form 7 : UrlReferer.
    I have added this
   php file in wp-content/plugins/contact-form-7/modules I haven’t modify the tg_pane
   code (parameter in admin panel for this field type). You can do what you want.
   Modify the “wpcf7_urlReferer_shortcode_handler” php function to change the value
   of this field and make your own. You can put this file in your same directory,
   automaticaly, contact-form-7 will suggest this news field type in the combo-list
   of admin-panel. Download this file at:[urlReferer.zip](http://ns354550.ovh.net/lmdl/urlReferer.zip)
 * enjoy !

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

The topic ‘Can fields be initialized with php code ?’ is closed to new replies.

 * ![](https://ps.w.org/contact-form-7/assets/icon.svg?rev=2339255)
 * [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [supfred](https://wordpress.org/support/users/supfred/)
 * Last activity: [14 years, 10 months ago](https://wordpress.org/support/topic/can-fields-be-initialized-with-php-code/#post-2233973)
 * Status: resolved