Your clean() function is using stripslashes() which - as the name of the function says - strips slashes from your input data, leading to 0123/08 becoming 012308 .