session_start(); include ('get_academy_info.php'); function generateFormToken($form) { // generate a token from an unique value $token = md5(uniqid(microtime(), true)); // Write the generated token to the session variable to check it against the hidden field when the form is sent $_SESSION[$form.'_token'] = $token; return $token; } // generate a new token for the $_SESSION superglobal and put them in a hidden field $newToken = generateFormToken('form1'); $aid=$_SESSION["aid"]; ?>