链接到其他网站后,请检查单选按钮

Basically im building a dropdown menu which works with radio buttons. if a button is checked, the submenu will open. further if i click a link of the submenu, it redirects to the desired page and all radio buttons are unchecked again. How can i keep the button checked?

here's the code:

 echo '
 <li><label for="menu_'.$c.'"><span>'.$custom_term->name.'</span></label>
 <input type="radio" name="category" id="menu_'.$c.'" />
 ';  

heres the full code might be pretty easy, but im not familiar with this aspects of php…

Read a tutorial about passing information with PHP.

The steps are:

  1. When the user is redirected to the other page, add the buttons which are check as a parameter to the URL.

  2. Then read the URL parameters by using jQuery like so.

  3. And lastly, check the buttons on page load with jQuery's .attr(•) function as can be see here.

I hope that answers your question.

Update

Regarding the passing of variables through a Wordpress permalink is absolutely possible. It is basically the same principle.

You can read about doing so by searching for it on Google LIKE THIS.

Also, please read this question: How to pass extra variables in URL with Wordpress.