Hello,
I saw a couple of threads about combining a static value with a dynamic value for the subject line in the email. I'm a total PHP newbie, but I could probably manage to not break things horribly if I tried that. 🙂
http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=5&t=16575&p=44680&hilit=subject#p44680
http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=5&t=14524&p=34399&hilit=subject#p34399
However, I need to combine 2 dynamic fields in the subject line. For example, if my form was:
Name (text_1)
Date of Last Visit (date_1)
Information Needed(text_2)
I want the subject to read something like
Information Request - text_1 , date_1
Any way for a PHP noob to manage that? 🙂
Thanks!
I saw a couple of threads about combining a static value with a dynamic value for the subject line in the email. I'm a total PHP newbie, but I could probably manage to not break things horribly if I tried that. 🙂
http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=5&t=16575&p=44680&hilit=subject#p44680
http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=5&t=14524&p=34399&hilit=subject#p34399
However, I need to combine 2 dynamic fields in the subject line. For example, if my form was:
Name (text_1)
Date of Last Visit (date_1)
Information Needed(text_2)
I want the subject to read something like
Information Request - text_1 , date_1
Any way for a PHP noob to manage that? 🙂
Thanks!
Hi fiordhraoi,
Try
Bob
Try
<?php
$text_1 = JRequest::getString('text_1', '', 'post');
$date_1 = JRequest::getString('date_1', '', 'post');
$subject = "Information Request - $text_1, $date_1";
JRequest::setVar('subject', $subject);
?>
and use subject in the Dynamic Subject boxBob
Hey Bob,
Thanks for the quick response! Not quite working out so far unfortunately. I'm getting this as the subject line:
Information Request - $text_1, $date_3
So it looks like it's just treating the variable names as text. I tried putting them outside the quotes, but that didn't work, just returned an error and I got a no subject email.
Also, just to double check - should this line
read ('date', '', 'post') or ('date_1', '', 'post')?
Thanks for your help, I really appreciate it.
Thanks for the quick response! Not quite working out so far unfortunately. I'm getting this as the subject line:
Information Request - $text_1, $date_3
So it looks like it's just treating the variable names as text. I tried putting them outside the quotes, but that didn't work, just returned an error and I got a no subject email.
Also, just to double check - should this line
$date_1 = JRequest::getString('date', '', 'post');
read ('date', '', 'post') or ('date_1', '', 'post')?
Thanks for your help, I really appreciate it.
Hi fiordhraoi,
Sorry, my typos. That should be date_1 and this line needs double quotes
Bob
Sorry, my typos. That should be date_1 and this line needs double quotes
$subject = "Information Request - $text_1, $date_1";
I've corrected my original post.Bob
Update: Got it working!
Using the double quotes in $subject for the concatenation did the trick. Thanks for the help!
<?php
$text_1 = JRequest::getString('text_1', '', 'post');
$date_3 = JRequest::getString('date_3', '', 'post');
$subject = "Information Request - $text_1 , $date_3";
JRequest::setVar('subject', $subject);
?>
Using the double quotes in $subject for the concatenation did the trick. Thanks for the help!
This topic is locked and no more replies can be posted.