Hey,
PHP is loaded server side and so does not recognise any user input unless the page is reloaded. As stated above javascript would be the way to go to handle this (the example code shows jQuery (a popular javascript library included in wordpress). You can add javascript to any html code with the use of “<script></script>” tags.
And something like this should do what you are after. You would need to replace the ids with your own:
<script>
jQuery( '#radio_one' ).on( 'click', function() {
jQuery( '#element_two' ).hide();
jQuery( '#element_one' ).show();
}
jQuery( '#radio_two' ).on( 'click', function() {
jQuery( '#element_one' ).hide();
jQuery( '#element_two' ).show();
}
</script>
I’ve tried to write this in a very simple way that’s easy to understand. This looks for an element with id=”radio_one” and when it is clicked, hides element with id=”element_two” and shows element with id=”element_one”. And then the reverse is done when radio_two is clicked.
Obviously your ids should be meaningful within your code.
Hope that helps!
Regards ??