save posted data to local storage in correct format