I am making a wordpress plugin but I am having difficulty accessing the results from an array in a function

Radio Box:

<!-- First radio button -->
						<label><input name="posk_options[radio_group_two]" type="radio" value="satellite" <?php checked('satellite', $options['RADIO_GROUP']); ?> /> Satellite</label><br />

						<!-- Second radio button -->
						<label><input name="posk_options[radio_group_two]" type="radio" value="hybrid" <?php checked('hybrid', $options['RADIO_GROUP']); ?> /> Hybrid</label><br />
function MY_function ($atts, $content = null) {
       ), $atts));
       $src = "...ptype=".$RADIO_GROUP."..se";
       return '...';

Ive edited out some of the needless code and just put ... there.
The code above does not work. I am trying to get the result from the radio box to insert further down in the function but I cannot access it. The radio box is selected from an options page and saves succesfully.
So I want $RADIO_GROUP to read satellite or hybrid.
What can I do to read the result from the array and insert it in a different function?
Thanks in advance

Recommended Answers

All 3 Replies

No ideas? I am on abit of a tight schedule here and would really appreciate any help

you can use Javascript, more correctly, jQuery:
if you have for example this in your html:

     <input type="radio" value="button1 name=bg1">MyButton
     <input type="radio" value="button2" name="bg1">MyButton2

Use this jQuery code to easily retrieve what button from the group was pressed:

$("form :radio").find(":checked").val();

If you print this value you will get either "button1" or "button2" as a result, depending what button was pressed.

Can this help you?

If your $_POST variable is available to your function:
$selected_radio = $_POST'];

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.