Hi,
I am looking for a way to pass PHP variables from my form to the email template or even if this is possible?
What I am looking to do is put a conditional statement within the email template to send different emails dependent on the PHP values passed though. It seems I can pass field {values} through fine but not PHP.
I have carried out a search and tried various things mentioned such as getstring() etc, but none seem to work. Any ideas?
thanks in advance.
I am looking for a way to pass PHP variables from my form to the email template or even if this is possible?
What I am looking to do is put a conditional statement within the email template to send different emails dependent on the PHP values passed though. It seems I can pass field {values} through fine but not PHP.
I have carried out a search and tried various things mentioned such as getstring() etc, but none seem to work. Any ideas?
thanks in advance.
Hi James181,
If you turn off the Rich Editor in the Email Setup | Properties box then you can add PHP directly to the Email template.
Bob
If you turn off the Rich Editor in the Email Setup | Properties box then you can add PHP directly to the Email template.
Bob
Hi Greyhead,
Thanks for your quick reply. I already have the editor turned off so I can display PHP, however it is the PHP values sent from the form that do not seem to pass though.
For example; if I set a variable '$test' in the form code box, I am not able to echo this in the emails. I know that PHP is switched on in the email because I can echo basic text statements.
I am thinking this has something to do with sessions?
thanks
Thanks for your quick reply. I already have the editor turned off so I can display PHP, however it is the PHP values sent from the form that do not seem to pass though.
For example; if I set a variable '$test' in the form code box, I am not able to echo this in the emails. I know that PHP is switched on in the email because I can echo basic text statements.
I am thinking this has something to do with sessions?
thanks
Hi James181,
You could declare the variables as global and pass them that way but it's generally easier to use the PHP $_POST array where the form results are stored. I tend to use the Joomla! code to access them
To 'set' rather than 'get' use
Bob
You could declare the variables as global and pass them that way but it's generally easier to use the PHP $_POST array where the form results are stored. I tend to use the Joomla! code to access them
$var = JRequest::getVar('var', '', 'post');
YOu can also use getString(), getInt(), . . . to add more validation; and you can set a default value in the second parameter.To 'set' rather than 'get' use
JRequest::setVar('var', $var);
Bob
This topic is locked and no more replies can be posted.