ibolui
05-26-2008, 02:04 AM
hi, i am facing a weird problem with my first attempt at flex, php and mysql. please pardon me if this is not the correct place to post my question.
i had a form created using flex and json, with php as the backend. below are segments of my codes..
//get the raw JSON data and cast to String
var rawData:String = String(event.result);
var user = JSON.decode(rawData);
first_name.text = user.first_name;
last_name.text = user.last_name;
email.text = user.email;
if (user.gender == "male") {
male.selected = true;
} else {
female.selected = true;
}
var bday:Date = new Date(user.birthday);
day.selectedIndex = bday.getDate() - 1;
month.selectedIndex = bday.getMonth();
year.selectedIndex = year_array.indexOf(bday.getFullYear().toString());
........
echo json_encode($_SESSION['user']);
when i first load the page, everything is being populated correctly on the flex frontend. however, when i refresh the page using f5, the birthday fields are incorrect. in the sense that it becomes 1 jan 1970.
i tried to print out the value of user.birthday and it is indeed 1 jan 1970. but i am not sure why it has become this value..
i had a form created using flex and json, with php as the backend. below are segments of my codes..
//get the raw JSON data and cast to String
var rawData:String = String(event.result);
var user = JSON.decode(rawData);
first_name.text = user.first_name;
last_name.text = user.last_name;
email.text = user.email;
if (user.gender == "male") {
male.selected = true;
} else {
female.selected = true;
}
var bday:Date = new Date(user.birthday);
day.selectedIndex = bday.getDate() - 1;
month.selectedIndex = bday.getMonth();
year.selectedIndex = year_array.indexOf(bday.getFullYear().toString());
........
echo json_encode($_SESSION['user']);
when i first load the page, everything is being populated correctly on the flex frontend. however, when i refresh the page using f5, the birthday fields are incorrect. in the sense that it becomes 1 jan 1970.
i tried to print out the value of user.birthday and it is indeed 1 jan 1970. but i am not sure why it has become this value..