I have created a form below and some javascript code in php, the it doesnt redirect to other pages.
<form method="post" name="for">
<?php
echo "<input type='text' name='text1'><input type='submit' name='submit' value='go' onclick='fon1();'>";
?>
</form>
<?php
echo "<script type='text/javascript'>";
echo "function fon1(){";
echo "var k = confirm('Confirm Delete');";
echo "if(k == true){";
echo "window.location = 'http://www.google.com'; }";
echo "else{ window.location = 'http://www.yahoo.com';} ";
echo "}</script>";
?>