How can use a simple dialog box when a button is clicked?
echo '<input type="submit" name="delete" value="delete">';
Should I use on click
in my button?
echo '<input type="submit" name="delete" value="delete" on click="????">';
This button deletes user information, but it would be better to ask before deleting.
if user chose "بله", then perform deletion, or if user chose "خیر", then do nothing.
Thanks
This is going to require a client-side language, such as JS.
You can look into JS alert()
, or confirm()
for an "Ok" and "cancel" box.
echo '<input type="submit" name="delete" value="delete" onclick="if!(confirm(\"Really Delete?\")) return false;">';
This will create a submit button that will not submit if the user clicks cancel.