Here is the Javascript code, just for test:
<script type="text/javascript">
function show_confirm()
{
var r=confirm("Are you sure?");
if (r==true)
{
}
else
{
}
}
</script>
And this is the php code:
<form action="Test.php" method="post">
<input type="text" name="test"/>
<input type="submit" value="submit" onclick="show_confirm()"/>
</form>
So if the submit button is clicked, a confirm box will pop out. And if "OK" button is clicked, the page will be redirected to Test.php and post method will be executed, like a normal php page submit operation. Or else, if the "cancel" button is clicked, i want it stay the same page and post method won't be executed. Is this function can be implemented and how to modify the code? I know PHP is for server and JS is for client. I'm not sure if I can mix them like this. Or I should use Ajax? Thanks for help!