advance help with serialized
-
First please help!
I’m adding a meta box
I grab the values in the form and serialize them before adding to post_meta.
In my save function I do the regular checks: is it the same as before, is it new.
This is where my problem lies, The comparisons are all hooped:
function mySave($post_id){ $submitted_data = serialize($_POST['recipe']); $saved_data = get_post_meta($post_id, 'recipe', true); ... }right now these 2 strings are indentical.
The moment I do this
if($saved_data == $submitted_data){ return $post_id; }It breaks!
function mySave($post_id){ $submitted_data = serialize($_POST['recipe']); $saved_data = get_post_meta($post_id, 'recipe', true); if($saved_data == $submitted_data){ echo("saved:" . $saved_data . ""); echo("submitted:" . $submitted_data . ""); return $post_id; } echo("saved:" . $saved_data . ""); echo("submitted:" . $submitted_data . ""); die; ... }So the result of the above is:
saved: [my value - correct] submitted: [my value - correct] saved: [empty string! - not correct!] submitted: [my value - correct]BUT the second 2 echos and shouldn’t have executed!
AND If I remove my ‘return’ from inside my If()saved: [my value - correct] echo: [my value - correct] saved: [my value - correct] echo: [my value - correct]Again the second 2 echos shouldn’t have executed!
Please please help.
The topic ‘advance help with serialized’ is closed to new replies.