Dashboard widget that interacts with front-end by shortcode

So i’m stuck with this really straight forward issue, but I don’t know how to solve it.

Basically I want a dashboard widget form which has a drop down with 2 options. If 1 option is selected and the form is submitted, there will be set a global variable which then can be used by a shortcode in the front-end.

So when option 1 is chosen from the back-end, some text will be echoed in the front-end and when option 2 is chosen from the back end, some other text will be echoed in the front-end.

I’m using the plugin My Custom Functions to insert the PHP in my back-end.

function show_macl_dashboard() {
echo ‘<form method=”post”>
<select name=”baanstatus”>
<option value=””>Baan is…</option>
<option value=”open”>Open</option>
<option name=”test” value=”gesloten”>Gesloten</option>
</select>
<input type=”submit” value=”Submit”
</form>’;
$status = $_POST[‘test’];
echo “De baan is: $status”;
}

So this is what my back-end form looks like. I have no way of handling it yet and I don’t know how to. Please help me out a little, would be appreciated! 🙂

Read more here:: Dashboard widget that interacts with front-end by shortcode

Leave a Reply

Your email address will not be published. Required fields are marked *