0

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

3
Contributors
3
Replies
5
Views
6 Years
Discussion Span
Last Post by ddymacek
0

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

0

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

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

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?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.