I have a Delete button in my PHP page which deletes a record. But when I delete that button I do a confirm box with:
JavaScript
x
<form action="log.php" method="post" onsubmit="return confirm('Are you sure?');">
Can I make it so when they confirm they have to fill in a password?
So what I mean is something like this
JavaScript
<form action="log.php" method="post" onsubmit="return confirm('password :');">
And then they have to fill in a password
Thanks in advance.
Advertisement
Answer
Hi You Need some thing like this, Modify according to your requirements
JavaScript
<script>
function do_check()
{
var return_value=prompt("Password:");
if(return_value==="your_password")
return true;
else
return false;
}
</script>
<form action="log.php" method="post" onsubmit="return do_check();">