@Buttered_Toast’s solutions is what you are looking for, if you were in a position to use it.
There are a bunch of problems with your code.
- Variables
$confused_about_treatment_editor
,$estimated_price_editor
, and$satisfaction_guarantee_editor
are never instantiated. - The values of
$option_name
and$option_value
are changed three times, but only the last value is ever used. - There is no closing PHP tag between your code and your form.
I’m not sure if you intend to call go_back()
every time, but it is called every time.
I would recommend using update_option()
for form values that will be changed during the live of the site. For values that you don’t want mutated you should use add_option()
.
You could try removing everything between your // run validation comment
, and $status
variable instantiation with this…
$status = update_option('form_values', [
'confused_about_treatment' => isset( $_POST['confused_about_treatment'] ) ? $_POST['confused_about_treatment'] : '',
'estimated_price' => isset( $_POST['estimated_price'] ) ? $_POST['estimated_price'] : '',
'satisfaction_guarantee' => isset( $_POST['satisfaction_guarantee'] ) ? $_POST['satisfaction_guarantee'] : '',
]);