<form id="form" action="index.php" method="post"> <input type="radio" onclick ='document.getElementById('form').action="index2.php";' /> <input type="submit" /> </form>