So im asking what options do I have other than redirecting GET variables when Im trying to repopulate a form?
Im thinking I can create session variable and use that also. Am I correct that these are the ONLY 2 ways?
What I have now is:
if ( count($m) > 0 ) {
// there is an error in fields filled out so we are sending user back to form.
$_SESSION["myarray"] = $m;
header("location: ./edit.php?datefield=".$datefield."&text=".$entry."&flag=".$flag);
}
but this reveals my variable to the user. I want to avoid this.
UPDATE I re-worded my question and the code to be clearer. I also like found that the solution for me was to use an include('edit-error.php'). Which is basically the original edit.php with everything stripped out but the code needed to generate the form, and I populated edit-error.php with the needed variables. I never had this in my tool box before so I am grateful to the user who suggested it.
include('edit.php'), and inside edit.php, you can look for variables that you have set to specify that there are errors, and also pre-fill form values with those already entered. instead of redirecting