data retrieval presents last set of data

There’s a problem with the basic flow.
Just bring the 4th item to the top,

so your new order will be :

  1. Check if the form input field is set, if so, update table via POST
  2. Retrieve data from wordpress custom table via get_results() or
    get_row()
  3. Parse out data into variables, via $row->XXXX or foreach
    ($rows as $data)
  4. Display in form
  5. When submit is clicked refresh file and go to item 1, to retrieve data.

The problem is when the submit button is pressed and page is refreshed, first you retrieve the data from the database without updating the data, so you still get the same data-set since the database isn’t updated yet, then you update the database.

Simply you have to update/inset the database before anything, then you can retrieve the data from the updated database.