Topic: Problem with saving Json encoded datas.
Hi,
Here i am developing a hrm module for FA. in the middle, i have the problem of saving json encoded data. Here is my code,
$kv_sal_structure = array(
'empl_hra' => (empty($_POST['empl_hra'])) ? '0' : $_POST['empl_hra'],
'empl_ca' => (empty($_POST['empl_ca'])) ? '0' : $_POST['empl_ca'],
'empl_fa' => (empty($_POST['empl_fa'])) ? '0' : $_POST['empl_fa'],
'empl_ma' => (empty($_POST['empl_ma'])) ? '0' : $_POST['empl_ma'],
'empl_ea' => (empty($_POST['empl_ea'])) ? '0' : $_POST['empl_ea'],
'empl_sa' => (empty($_POST['empl_sa'])) ? '0' : $_POST['empl_sa'],
'empl_lta' => (empty($_POST['empl_lta'])) ? '0' : $_POST['empl_lta'],
'empl_pt' => (empty($_POST['empl_pt'])) ? '0' : $_POST['empl_pt'],
'empl_gi' => (empty($_POST['empl_gi'])) ? '0' : $_POST['empl_gi'],
'empl_pf' => (empty($_POST['empl_pf'])) ? '0' : $_POST['empl_pf'],
'empl_esi' => (empty($_POST['empl_esi'])) ? '0' : $_POST['empl_esi'],
'empl_l_a' => (empty($_POST['empl_l_a'])) ? '0' : $_POST['empl_l_a'],
'empl_it' => (empty($_POST['empl_it'])) ? '0' : $_POST['empl_it']);
$sal_structure =json_encode($kv_sal_structure);
Here i got check box vaules and make it as array and processed as array, than i tried to save it on database, but while saving into the database, it looks like the following structue.
html ""e " instead of double quotes.
How can i save the data like
{"empl_hra":"1","empl_ca":"1","empl_fa":"0","empl_ma":"0","empl_ea":"0","empl_sa":"0","empl_lta":"0","empl_pt":"0","empl_gi":"0","empl_pf":"0","empl_esi":"0","empl_l_a":"0","empl_it":"0"}
Help me to solve it.
HRM CRM POS batch Themes