While we could discuss the topic - POST via AJAX - I don't think that is the problem.
First, I assume the "league array" is set prior to the code you've shared... otherwise... this would really be bombing. You're dynamic radios should be fine with the onclick event as is. That said, what is actually happening with this code that makes you think there is a problem?
Is the AJAX always giving you the last selected team's point values only??
The reason that would be is that the SESSION is not persistent over an AJAX call. So if your AJAX handling script - "zz_get_test_points.php" - doesn't start out with a session_start() call or some inclusion of a session ini script from a framework you may have in place, then the session is not usable in the sense you would want it to be. In other words, $_SESSION['total_points'] would always be uninitialized when you were using it and would be initialized by the current selected team's points ONLY. The tally process wouldn't work.
If that is the issue... there is another. You can have n teams and n leagues... but you can only pick 1 team per league... but you only have 1 session var to hold the total. So... if you have...
L1 - T1: 10pts, T2: 15pts, T3: 5pts
L2 - T1: 0pts, T2: 10pts, T3: 15pts
L3 - T1: 20pts, T2: 10pts, T3: 5pts
we may pick: L1T2, L2T3, L3T2 which would give us 15+15+10 = 40pts total... now what happens if I change my L1 selection to say T1 instead of T2? Total points SHOULD say 35pts... but with the logic you are trying to implement, at best, this would no tell you the total is 50pts. There is no "substraction" of points... or handle on each teams points.
Is it possible to eliminate AJAX here though? Just store the points as the teams values on the radio buttons. Or do you need those radios to have the id as the value for form submission beyond the process you are sharing here?
In either case, you may want to just do the tally on return or in a session based array (again considering that you would have to start your session on the AJAX handling php script). Here's a description on those to resolutions... take your pick.
1 - on return of values...
Just return the point value from the ajax and insert it into a hidden form element (you would create 1 hidden container per league, something like <input type="hidden" id="league<?php echo $leagueid; ?>" value="" />). Then on return from the AJAX, takes its returned content and just say document.getElementById('league' + needAnotherParamForLeagueId).value = returnedValue; then automatically trigger a function that would tally all the values of all the hidden league fields.
Now... for the easier method...
2 - session based array
In your main page where the form is printed out, create this...
$_SESSION['leaguepoints'] = array();
Then as you loop through the leagues and print the radios, take the league id and make a new element in this array with it as the key...
$_SESSION['leaguepoints'][$league_row['ID']] = 0;
Then in your AJAX handling script - zz_get_test_points.php - you would simply update the appropriate array element AND loop through the array tallying the values....
...
$_SESSION['leaguepoints'][$teamsLeague] = $points;
...
$totalpoints = 0;
foreach ($_SESSION['leaguepoints'] as $league=>$points)
{
$totalpoints += $points;
}
echo $points; // or print or whatever you want to do to return the value.
Hope that helps. If you ever need help and want me to take a look, I have a direct help forum that I just open on my site for people to get programming help directly from me. My credentials are posted there to. http://www.evileyegames.com