It is generally better practice to remove all optional formating before inserting into the database and then adding the formating when displaying, to cause more consistancy, and to make comparing simpler. in this case, to remove the space you could use the PHP :
$zip_code = ereg_replace(" ", "", $zip_code);
then in the places you want to display it you could use many different formating tricks... for example all strings can be treated as arrays :
$zip_code[0]$zip_code[1]$zip_code[2] $zip_code[3]$zip_code[4]$zip_code[5]