Quick question on making sticky form values when form uses arays in values

Here is my form:

<label for="aId">This is an input box</label><input type="text" value="  " maxlength="40" class="aClass" id="aId" name="affiliate_hoover_plugin_options[aName]"/>

And this is what the the $_POST looks like after submission:


Array
(
    [affiliate_hoover_plugin_options] => Array
        (
            [aName] =>   Here is a value
        )
)

The trouble comes when I’m trying get the code right for a sticky value in another function

As expected this works great if an array isn’t used:

isset($_POST[$name]) ? print $_POST[$name] : null;

So my initial thought was that this would work with arrays, but it doesn’t:

isset($_POST[$option_name[$name]]) ? print $_POST[$option_name[$name]] : null;

I’ve tried different variations but the damn value isn’t sticking after submission

You can simply print $_POST[$option_name[$name]], there’s no need to a ternary operator. If there’s nothing in that variable, it will echo nothing anyway.

I also don’t understand your usage of the term “sticky.”

However, the code you presented is valid and works fine with arrays, so it’s not the syntax that’s the problem.