Validating and retaining form data using only php

Which is where it is! However, where all the non-menu select fields, apart from the email address which checks for valid email address, use strlen() to check for validity, I obviously cannot use that for a menu field.
Logic tells me that something like:

if  ($region_name = ("Select One")) {
          $error = true;
          $error8 = errorRegionName;
      }

should work but, although after validation the chosen menu item is retained, the error message that no selection has been made always appears. I’ve tried lots of other things but all with the same result…
I know I am not very good at this but I am trying, I’ve come a long way from being a complete non-programmer and I’m learning all the time, your help is very much appreciated.

ahahaha
what a silly mistake.
== not single =
hard to fihd though
they advise to write it countrary, to prevent such mistakes
(“Select One” == $region_name)
with = instead of == or === parse error will be raised

Oh, not a silly mistake - a really stupid one!! Yes, it works fine now . Thanks for pointing out that very stupid mistake1

I don’t believe this! I was too hasty saying it works fine. It does in the sense that the error message does not come up when a selection has been made but if it is left as “select one” i.e. no selection is made then no error message comes up, so plainly it’s not working!!

if  ("Select One" == $region_name) {
          $error = true;
          $error8 = errorRegionName;
      }

As you can see I’ve changed the order around as well as correcting the = but I cannot see why it is not working.

just check what goes to your script from the form when no region selected
it can be empty string or Select one with some deviations such as spaces or letter case.
put var_dump($region_name); somethere, look at the output and correct that string to compare.

Thanks! That solved the problem - I must remember to use var_dump() as a help in debugging in the future. Another lesson learned!