hi, replace this script
<script>
function myFunction() {
var x;
var r = confirm("Press a button!");
if (r == true) {
location.href = "http://www.yahoo.com";
}
else {
x = "You pressed Cancel!";
}
document.getElementById("demo").innerHTML = x;
}
</script>
no need to write a server side code here :P