SOLVED
if ( isset( $_POST['submit'] ) ) {
$option_name="order_ref" ;
$counter = get_option( 'order_ref' );
//Limit the counter, based on the range of orders you will be getting per day
if ($counter <= 99 ) {
$counter = $counter + 1;
} else {
$counter = 1;
}
if ( get_option( $option_name ) !== false ) {
// The option already exists, so we just update it.
update_option( $option_name, $counter );
} else {
$deprecated = null;
$autoload = 'no';
add_option( $option_name, $counter, $deprecated, $autoload );
}