Fix json_decode, we need the second parameter to specify an assoc array instead of an object

This commit is contained in:
james 2011-03-02 14:26:18 +00:00
parent 0e45df5df8
commit 5dba209aae

View File

@ -1079,7 +1079,7 @@ switch($request[0]) {
} }
if($_POST['mentors']) { if($_POST['mentors']) {
$mentors = json_decode($_POST['mentors']); $mentors = json_decode($_POST['mentors'],true);
$errors = array(); $errors = array();
foreach($mentors as $md){ foreach($mentors as $md){
$result = addMentor($_SESSION['registration_id']); $result = addMentor($_SESSION['registration_id']);
@ -1116,7 +1116,7 @@ switch($request[0]) {
break; break;
} }
$errors = array(); $errors = array();
$mentorList = json_decode($_POST['mentors']); $mentorList = json_decode($_POST['mentors'],true);
foreach($mentorList as $mentor){ foreach($mentorList as $mentor){
if(!is_array($mentor)){ if(!is_array($mentor)){
$errors[] = "Invalid mentor data: $mentor"; $errors[] = "Invalid mentor data: $mentor";