Show the submitted values in the form when validation fails

You can’t. If you’re using the settings API correctly, here’s what happens when you try to save your options:

  1. Form posts to options.php
  2. WordPress handles $_POST and runs update_option on your registered settings
  3. Your sanitize callback from register_setting is applied
  4. Any data that fails/you don’t return in your callback isn’t saved
  5. WordPress redirects back to your options page (GET)

Now you’re back on your options page, with the error message, but the data wasn’t written to the database and now $_POST will be empty.

The only way I can see around it is to store the “incorrect” data in another option, inside your sanitize callback, for use on the returned page.