Forums

How to put the time submitted in the email?

Greg R. 06 Dec, 2007
I have the date and time for the form submission being printed by PHP on the results page, but I need to get it into the email as well to provide a timestamp for the form submission. Here is the code:

// Variable for hours

echo date("l, F d, Y" ,time());

$hourdiff = "1"; // hours difference between server time and local time


$timeadjust = ($hourdiff * 60 * 60);

$melbdate = date(" H:i",time() - $timeadjust);

print ("$melbdate"«»);


How do I pass this to the email template? Thanks!
GreyHead 07 Dec, 2007
Hi Greg,

Put this code (without the echo or print statements) in the 'before email' box then put
<?php echo $melbdate; ?>
in your template and that should do it.

Bob
Greg R. 18 Dec, 2007

Hi Greg,

Put this code (without the echo or print statements) in the 'before email' box then put

<?php echo $melbdate; ?>
in your template and that should do it.

Bob



Sorry Bob, where is the 'before email' box? I don't see it at all. I have : Form HTML, Form Javascript, On Submit Code, and Email Template.

thanks,

Greg
Max_admin 19 Dec, 2007
Hi Greg,

Then you have an older ChronoForms version, you will need to overwrite all files and add any new files and also add some new field to the database table to get the latest ChronoForms version running!🙂

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Greg R. 22 Dec, 2007
Will it work with 1.x, or will I have to upgrade to 1.5?
GreyHead 22 Dec, 2007
Hi Greg,

It works fine with Joomla 1.0.x

Bob
Greg R. 27 Dec, 2007
Ok, I have overwritten my files, however, it is clear that there are new database fields that I need for this to function. Do you have .sql that I can run to insert the new fields/tables?
GreyHead 27 Dec, 2007
Hi Greg,

I don't think that there was ever an upgrade script - I'll go and look though. Which version are you upgrading from?

Bob
Greg R. 27 Dec, 2007

Hi Greg,

I don't think that there was ever an upgrade script - I'll go and look though. Which version are you upgrading from?

Bob



Version 2.0. Alternatively, is there anywhere that the exact table changes are listed, so that I can do it manually?<br><br>Post edited by: Greg R., at: 2007/12/27 18:56
Max_admin 28 Dec, 2007
Hi Greg,

Only 1 field I think named : `onsubmitcodeb4` LONGTEXT NOT NULL to the jos_chrono_contact table!

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Greg R. 28 Dec, 2007
Ok, we are not quite there yet.

I overwrote the files to upgrade to 2.36.

I added the field onsubmitb4 to the database.

The 'before email' code field now appears in the admin, and I can successfully save it. HOWEVER, I put the following in 'before email':

<?php
date("l, F d, Y" ,time());

$hourdiff = "1"; // hours difference between server time and local time


$timeadjust = ($hourdiff * 60 * 60);

$melbdate = date(" H:i",time() - $timeadjust);

?>


And have this line at the top of my email template:

<?php echo $melbdate; ?><br>


But the date does not appear in the email, even though, as I mentioned, I am using the same functions on the results page.

What did I miss??
GreyHead 30 Dec, 2007
Hi Greg,

I just tested by putting all the code into the template and it works fine.
<?php
// date("l, F d, Y" ,time());
$hourdiff = "1"; // hours difference between server time and local time
$timeadjust = ($hourdiff * 60 * 60);
$melbdate = date(" H:i",time() - $timeadjust);
echo $melbdate;
?>
Bob<br><br>Post edited by: GreyHead, at: 2007/12/29 19:30
Greg R. 01 Jan, 2008
Bob, I did the same, and the thing is, php put into the email template is simply not being used at all. What could cause this?

A file not being updated? Which one? A field in which the data type has changed from version 2.0? I suspect that the upgrade is incomplete.
Max_admin 01 Jan, 2008
Hi Greg,

I guess you didn't overwrite the frontend files ? under : components/com_chronocontact/ ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 01 Jan, 2008
Hi Greg,

As Max says, looks as though your ChronoForms isn't fully up to date. PHP in the template has been supported since v2.3

It's the components/com_chronocontact/chronocontact.php file that supports this.

Bob<br><br>Post edited by: GreyHead, at: 2008/01/01 12:36
Greg R. 02 Jan, 2008
Guys, thank you for all your help, but that is not it. My main/administrator/components/com_chronocontact/chronocontact.php file is the latest version. As far as I can tell, anything within <?php> tags in my email template is being ignored.
GreyHead 02 Jan, 2008
Hi Greg,

Please take a backup copy of your form file from the ChronoForms Form Manager and post it here or send it to me at the address in my sig so I can take a closer look.

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