Bas
Bas

Reputation: 118

Use URL parameter in Contact Form 7 Field

I would like to add some PHP in my form created with Contact Form 7, a WordPress plugin. I've already tried this but it didn't work: Executing PHP Code in Contact Form 7 Textarea. Every time I insert the function, my website crashes.

I have a variable stored in a $_SESSION. I have put that variable in a hidden input and now I would like to take the value of the hidden input and place it in the contact form. How can I do this? Thanks!

Screenshot of the website and the hidden input

Screenshot of the back-end of the form

Upvotes: 5

Views: 25768

Answers (1)

BenB
BenB

Reputation: 2907

I think this approach can work for you.

  1. Set a url param to the link. Example domain.com/more-info?previous-link=home-page
  2. In your form add this field

    [text* previous-link default:get default:post_meta "Previous link"]
    

You can see more examples in the docs

Upvotes: 15

Related Questions