23
25

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

確認フォームを表示する

Posted at

php等で情報をpost送信する前に
ユーザにもう一度、内容を確認させたいときにおすすめ。

html
<body>

<script>
    /**
     * 確認ダイアログの返り値によりフォーム送信
    */
    function submitChk () {
        /* 確認ダイアログ表示 */
        var flag = confirm ( "送信してもよろしいですか?\n\n送信したくない場合は[キャンセル]ボタンを押して下さい");
        /* send_flg が TRUEなら送信、FALSEなら送信しない */
        return flag;
    }
</script>


<form action="×××.php" method="post" onsubmit="return submitChk()">
	<input type="text" name="text" value="" /><br/>
	<input type="submit" value="送信する"/>
</form>

</body>

送信ボタンを押した直後に確認フォームが表示される。

23
25
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
23
25

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?