有个单选框,选项是a和b,没有submit的按钮。
希望在php里得到这个radio button的当前选中值。我的意思是类似$value="a"这样的。请问如何实现?

解决方案 »

  1.   


    function ch(v){
    document.forms[0].submit();
    }<input type="radio"  value="a"  name="a" checked="checked" onclick="ch('a')"   />
    <input type="radio"  value="b"  name="a" onclick="ch('b')" />
      

  2.   

    没有用php得到那个变量值的方法吗?
      

  3.   


    if(isset($_POST['form_radio'])){
    $radio = $_POST['form_radio'];
    echo $radio;
    }<html>
    <body>
    <form name="form1"  action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" >
    <input type="radio" value="a" name="form_radio" /> a
    <input type="radio" value="b" name="form_radio" /> b
    <input type="submit" value="提交">
    </form>
    </body></html>