如何在脚本中从javascript值设置会话变量

Ok, so here is the ordeal. I have a class in a .php file with a javascript function that is being called in an onclick event. Everything there works fine and dandy, however I need to execute a php function within the script and set a few session variables before I can do that. This is the php I need inserted into the javascript function:

    $_SESSION["AccountUsername"] = document.getElementById("Username").value;
    $_SESSION["Email"] = document.getElementById("tEmaili").value;
    $_SESSION["Password"] = document.getElementById("Password").value;

    addaccount();

I have the .php file with the php function set to

require_once(thefile.php);

at the beginning of the file. Than you to anyone that can offer insight or a solution. I'm fairly new to this, so feel free to give extra pointers.