How to retain the values from dropdown category lists after wrong form submission?

Like Ash was saying, something like this using $_REQUEST or $_POST will do it.

<?php
  $args['exclude'] = "12,20"; // omit these two categories
  $categories = get_categories($args);
?>
<select class="selectpicker btn-block" name="coupon_cat" id="category">
  <option value="">Категори Сонгох</option> <!-- if nothing else is selected, this will be selected automatically -->
  <?php foreach($categories as $category): ?>
    <?php $selected = (isset($_REQUEST['coupon_cat']) && $_REQUEST['coupon_cat'] == $category->term_id)?'selected="selected"':''; ?>
    <option value="<?php echo $category->term_id;?>" <?php echo $selected ?>><?php echo $category->name; ?></option>
  <?php endforeach; ?>
</select>