Considering its PHP and server side you are going to have to validate after a submission no matter what (unless you want to use JS)
If you want to keep the values than you just store them in a seperate variable and echo that out in the html, (Requires the form to be a php file not an html file)
here is an example of me echoing a variable to an html field (not tested), it should basically just convert numbers to letters and echo them to the same field after submission.
$val = "123-456-7890";
$num = array('1', '2', '3', '4', '5', '6', '7', '8', '9', '0');
$let = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j');
$val = str_replace($num, $let, $_POST['phone-number']);
<input type="text" name="phone-number" id="phone-number" value="<?php echo $val; ?>">
<input type="submit" name="submit">
Thats my archaic way of doing it, although im sure the experts have a super sleek quick way of doing it rather than an ugly php tag in the middle of your php.