あなたがやろうとしていると私が思うことをしようとしているなら、ユーザーが税込み/税抜きで価格を表示できるようにしたいと考えています。
1 つの可能性は、JavaScript ライブラリである jQueryを使用することです。
このルートを選択する場合は、各価格をページに出力して、ユーザーが見たくない価格を非表示にすることができます。
<html>
<head>
<!-- Include the jQuery Library via CDN -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
</head>
<body>
<!-- Display Prices, hide one -->
<div class="with_vat">$xxx</div>
<div class="without_vat" style="display:none">$yyy</div>
<!-- Options -->
<input type="radio" name="vat_choice" value="1" checked /> Show Vat
<input type="radio" name="vat_choice" value="0" /> Exclude Vat
<!-- jQuery to Hide/Show the divs when radio is changed -->
<script>
$("input[name='vat_choice']").change(function(){
// Get Value
var vatChoice = $(this).val();
if(vatChoice == 1){
$('.with_vat').show();
$('.without_vat').hide();
}
else{
$('.with_vat').hide();
$('.without_vat').show();
}
});
</script>
</body>
</html>
http://jsfiddle.net/PKh3y/で実際のコードを確認できます。
ラジオボタンがクリックされたときにリダイレクトすることで、目的の結果を達成することもできます。以下のソリューションでは、(少しだけ) PHP を使用しています。
<html>
<head>
<!-- Include the jQuery Library via CDN -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
</head>
<body>
<!-- Display Prices depending on $_GET parameters -->
<?php if(!isset($_GET['without_vat'])): ?>
<div class="with_vat">$xxx</div>
<?php else: ?>
<div class="without_vat">$yyy</div>
<?php endif; ?>
<!-- Options -->
<input type="radio" name="vat_choice" value="1" checked /> Show Vat
<input type="radio" name="vat_choice" value="0" /> Exclude Vat
<!-- jQuery to redirect when radio is changed -->
<script>
$("input[name='vat_choice']").change(function(){
// Get Value
var vatChoice = $(this).val();
if(vatChoice == 1){
window.location = 'http://example.com/';
}
else{
window.location = 'http://example.com/?without_vat=1';
}
});
</script>
</body>
</html>
それがあなたの質問に答えてくれることを願っています。幸運を祈ります!