wwfc_barmy_army Posted October 31, 2007 Share Posted October 31, 2007 Hello. I have this code to check the age of people signing up: <?php $month = $_POST['birthmonth']; $day = $_POST['birthdate']; $year = $_POST['birthyear']; // create timestamp for user's age $user_timestamp = mktime(12,0,0,$month,$day,$year); // work out difference between now and the user's timestamp $age = $time() - $user_timestamp; // convert $age timestamp to years (1yr = 31556926secs) $age = $age / 31556926; if($age < 18) { echo "18-"; } else { echo "18+"; } ?> Although i'm getting the following error: Fatal error: Function name must be a string in myfilename on line 68 Line 68 being: $age = $time() - $user_timestamp; Any ideas? Thanks. Link to comment https://forums.phpfreaks.com/topic/75548-solved-age-validation-issue/ Share on other sites More sharing options...
kenrbnsn Posted October 31, 2007 Share Posted October 31, 2007 Remove the "$" from "$time()". The funtion name is "time()". Ken Link to comment https://forums.phpfreaks.com/topic/75548-solved-age-validation-issue/#findComment-382164 Share on other sites More sharing options...
wwfc_barmy_army Posted October 31, 2007 Author Share Posted October 31, 2007 Ahhhh! Thanks! Link to comment https://forums.phpfreaks.com/topic/75548-solved-age-validation-issue/#findComment-382165 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.