[Solved] Echo radio button value without using submit button in php


Here is your solution….

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>//jQuery Plugin
<?php 
if(!empty($_GET['a1'])){ $selected = $_GET['a1'];}
else{ $selected = 'home';}
?>
<form action="" method="post">
    <label>
        <input type="radio" name="a1" value="home" /> Home 
    </label></br>
    <label>
        <input type="radio" name="a1" value="site1" /> Site 1 
    </label></br>
    <label>
        <input type="radio" name="a1" value="site2" /> Site 2 
    </label></br>
</form>
<span class="r-text"><?php echo $selected;?></span>
<script>
    $('input[type=radio]').click(function(e) {//jQuery works on clicking radio box
        var value = $(this).val(); //Get the clicked checkbox value
        $('.r-text').html(value);
    });
</script>

1

solved Echo radio button value without using submit button in php