Select a status. The page reloads with the selected value in the query string and PHP keeps the matching radio button selected.
Selected value: All
$allowedStatus = [
'All',
'Live',
'Failed',
'Matured'
];
$enqStatus =
$_GET['enq_status'] ?? 'All';
if (
!in_array(
$enqStatus,
$allowedStatus,
true
)
) {
$enqStatus = 'All';
}
See PHP switch if your application maps each allowed value to different behavior.
$( 'input[name="enq_status"]' )
.on( "change", function () {
const params = new URLSearchParams({
enq_status: $( this ).val()
});
window.location.assign(
"radio-button-submit.php?" +
params.toString()
);
});
These original tutorial/demo routes are retained so no useful learner path is lost:
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.