การบันทึกค่าในตัวเลือกหลังจากส่งใน PHP

มาทำให้ตัวเลือกของผู้ใช้ ถูกบันทึกไว้หลังจากส่ง:

html<form action="" method="GET">
  <select name="test">
    <option value="1" <?php
      if (!empty($_GET['test']) and $_GET['test'] === '1') {
        echo 'selected';
      }
    ?>>item1</option>
    <option value="2" <?php
      if (!empty($_GET['test']) and $_GET['test'] === '2') {
        echo 'selected';
      }
    ?>>item2</option>
    <option value="3" <?php
      if (!empty($_GET['test']) and $_GET['test'] === '3') {
        echo 'selected';
      }
    ?>>item3</option>
  </select>
  <input type="submit">
</form>
Задание 1

ปรับเปลี่ยนงานก่อนหน้าเพื่อให้ ค่าที่เลือกไม่หายไปหลังจากส่ง