the code below only works on checkout_shipping, i get the $my_code value written to database when an order completed
but when i tried the same code to checkout_confirmation, nothing written to database
any ideas?

i'm using zen cart 1.51

PHP Code:
<?php 

//File checkout_shipping/header_php.php
if (isset($_SESSION['my_code'])) {
$my_code $_SESSION['my_code'];
}
if (
zen_not_null($_POST['my_code'])) {
$_SESSION['my_code'] = zen_db_prepare_input($_POST['my_code']);
}
$my_code $_SESSION['my_code'];


//File tpl_checkout_shipping_default.php
$my_code something;
echo 
zen_draw_input_field('my_code'$my_code$parameters 'readonly'$type 'text');

?>