PHP: Show yes/no confirmation dialog

后端 未结 13 2391
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-30 18:27

My PHP page has a link to delete one MySQL table datum. I want it to be in such a way that when I click the \'delete\' link a confirmation box should appear and it should ask \

13条回答
  •  天命终不由人
    2021-01-30 18:58

    onclick="return confirm('Log Out?')? window.open('?user=logout','_self'): void(0);"
    

    Did this script and afterwards i tought i go check the internet too.
    Yes this is an old threat but as there seems not to be any similar version i thought i'd contribute.
    Easiest & simplest way works on all browsers with/in any element or field.

    You can change window.open to any other command to run when confirmation is TRUE, same with void(0) if conformation is NULL or canceled.

提交回复
热议问题