The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
![]() |
about pre-parser and age from - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Modules / Other (https://forums.formtools.org/forumdisplay.php?fid=8) +--- Forum: Modules (https://forums.formtools.org/forumdisplay.php?fid=16) +--- Thread: about pre-parser and age from (/showthread.php?tid=2979) |
about pre-parser and age from - sentrateam - Apr 7th, 2014 Hi guys, First, i want to thank you for all form tools developer. This software is really help full. and for my question, i want to calculate age from the date submission id, then put it in the display export page. after reading this forum, i know the Submission Pre-Parser module is the key and i install it then. and i search the php function to do it. Code: <?php the goal is to be two row like ; Birthdate : dd/mm/yyyy Age : (this one will be automatically calculated by Pre-Parser module) thanks in advance RE: about pre-parser and age from - sentrateam - May 4th, 2014 help... anyone? please... RE: about pre-parser and age from - sentrateam - Jun 5th, 2014 (May 4th, 2014, 10:43 PM)sentrateam Wrote: help... anyone? please... ??? RE: about pre-parser and age from - Joe - Jun 5th, 2014 Have you tried plugging the submission into your code yet? <?php if ( (isset($_POST["birthDate "]) && !empty($_POST["birthDate "])) { //date in mm/dd/yyyy format; or it can be in other formats as well $birthDate = $_POST["birthDate "]; //explode the date to get month, day and year $birthDate = explode("/", $birthDate); //get age from date or birthdate $age = (date("md", date("U", mktime(0, 0, 0, $birthDate[0], $birthDate[1], $birthDate[2]))) > date("md") ? ((date("Y") - $birthDate[2]) - 1) : (date("Y") - $birthDate[2])); $_POST["age"] = $age; } ?> Cheers, Joe |