Hi,
I have a php page called: radio_page.php, it contains two radio buttons. First radio button is checked as default when loading the page. I need when clicking on second radio button to refresh the page and keep selection on second radio button, I am trying that as below, but it does not work. After refreshing the page the selection returns to the first radio button. Please advise. Thanks.
////////////radio_page///////
echo "<input type=radio id=rad1 checked=checked name=rad value=radio1 onclick=SelectRadio('rad1')> ";
echo "<input type=radio id=rad2 name = rad value=radio2 onclick=SelectRadio('rad2')> Time";
//////////javascript//////////
function SelectRadio(rad){
var selected_radio = document.getElementById(rad).value;
if(rad == 'rad2'){
window.location.href = 'radio_page.php';
document.getElementById(rad).checked = 'checked';
}
else{
window.location.href = 'radio_page.php';
document.getElementById(rad).checked = 'checked';
}
}