0

So I am brand new to ExpressionEngine....

I am on an expression engine entry page with a few hyperlinks...Based on which hyperlink I click, I want to navigate to another expression engine page with a contact form and dynamically set the value of the subject field based on which hyperlink was clicked on the previous page......How do I go about doing this? FYI - I'm not new to web programming - other frameworks I've worked in let you set a parameter in the hyperlink so it becomes part of the web request to the next page where you can then grab the parameterized value for setting the subject.

If you could even point me in the right direction, that would be helpful.

3

It's going to be a little more manual with expressionengine. You might have to set the parameters in the link yourself and use php (or a plugin)

Build the link similar to this:

<a href="/form?name={name}">{name}</a>

and fill out your form using php (php must be enabled on the form template):

<input type="text" name="name" value="<?php echo $_GET['name']; ?>">

Or that plugin:

<input type="text" name="name" value="{exp:parameters get="first"}">
| improve this answer | |
  • I highly recommend using a plugin, as pure-PHP slows down your templates. – kmgdev Jul 23 '14 at 21:28
  • Thanks, Johnathan - this is the perfect solution for our low traffic site. – Nona Jul 23 '14 at 21:39
  • Thanks kgrote - I'll try looking into the plugin solution for the long term. – Nona Jul 23 '14 at 21:48
0

Just use url segments. In the hyperlink href (www.domain.com/form) add whatever parameter you like to it (www.domain.com/form/subject) and then on the form page put value="{segment_2}" in your input tag. Read more in the EE docs about segments. You might have to encode/decode the uri if you use spaces etc.

| improve this answer | |
  • While you are technically correct (the best kind of correct), query strings would make more sense in this case than segments, as a segment would denote an entirely unique page. In this situation we just need to pass some metadata in order to modify an existing page. – kmgdev Jul 23 '14 at 21:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.