I have a letter writing campaign on a client's site and I want the name of the person to dynamically be added to the message textarea to be sent with the letter.

I have tried

%session[first_name]
%get[first_name]

I've tried

$first_name

with PHP snippets turned on.

I'm a newbie and I'm baffled.

Any help is greatly appreciated!

Comments

WorldFallz’s picture

What is 'first_name'? A core profile field?

===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz

dignosis’s picture

it's one of the 'keys' created in webform denoting the textfield containing the variable $first_name, one of the variables that i want to dynamically populate my letter.

thanks!

WorldFallz’s picture

Ah ok-- but where are you capturing the first name of the user filling out the form? You can't prepopulate the field if you don't first capture the value somewhere.

===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz

dignosis’s picture

right. the form looks roughly like this

first_name
last_name
street
city
state
zip

message (which has editable content by default)

i want to add

first_name last_name
city, state

to the signature of the letter.

here's the URL

http://bootblago.com/node/7

WorldFallz’s picture

duh-- the fog has finally cleared, lol. What about $_POST [ 'first_name' ]?

===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz

dignosis’s picture

i just tried that both with and without the <?php tags and it just tries to read those as cleartext.

i also tried it as %post[first_name] and no such luck either.

it seems like the textarea is not able to handle the PHP tags for some reason, which was why i was trying to use the % keys.

it's odd cuz the main descriptions, etc for the webform can handle PHP but the textarea itself doesn't seem to be able to collect any variables.

WorldFallz’s picture

Ahh... we're looking in different places. I think you need to do this in the form configuration 'additional processing' section which does accept php and provides the entire $form and $form_state variables for you to use.

===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz

dignosis’s picture

this is probably a very stupid question, but where would i find the form configuration 'additional processing' section?

dignosis’s picture

hyelp.

WorldFallz’s picture

Sorry-- i was away for the holidays.

The 'additional processing' textbox is in the 'Webform advanced settings' fieldset right on the node/edit form for the webform. Just edit the webform node, expand the fieldset, and you should see the 'additional processing' textbox at the bottom of the fieldset.

===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz