Dynamic Subject

Yue_Hong 07 Nov, 2009
Hi,

How to get dynamic subject works? I have created a form for user to upload file and type in some content, and the form will send to the email. Uploaded file will be renamed with date & time at the front of the filename. I would like to have the date & time that has been generated in the file upload function to be used as the ID and put in front of the email subject. Right now, I have "date('YmdHis').'mail subject name'" in the Dynamic Subject field, but it seems doesn't work. How can I do that? Thanks.
GreyHead 07 Nov, 2009
Hi Yue_hong,

The Dynamic fields *only* take an input field name, you cannot add PHP in there.

The way to do this is to add the PHP in the OnSubmit Before box
<?php
$subject = date('YmdHis').'mail subject name';
JRequest::setVar('subject', $subject);
?>
Then put subject (no quote and no brackets) into the Dynamic Subject box.

This will give you a subject like 20091107221646mail subject name I'm not sure that this is what you want?

Bob
Yue_Hong 10 Nov, 2009
Thanks GreyHead,

Here I want to ask, how can I add user's IP address into the mail subject? Also, it is possible to have chronoform automatically send mail to user after they submit the form?

Thanks
GreyHead 10 Nov, 2009
Hi Yue_Hong,

Use the same technique but add in the IP address value from $_SERVER["REMOTE_ADDR"]

Bob
This topic is locked and no more replies can be posted.