hi all,

I am using one javascript function for confirmation in submitting link in database. As we know there is two option comes for confirmation for YES and NO. But when i am clicking NO button then it is submitting the request . But i want when i click only on YES then it should submit form other wise it returns false.

But this is not going.So please help me to solve this. I am sending code which i am using :-- <a href="addlink.php?id=<?=$row[ID]?>" onClick="subconfirm()" class="nbluelinkfont">SUBMIT</a> and this is javascript code which i am using:----

function subconfirm() {
  
    if (!confirm("Are you sure to submit these details from database?"))  {

     return false;

       } else { return true;

          }
 }

But problem is that when i am clicking no then it is going to submit. Please help me to solve this.
thanks

thanks for reply,

But when i am writing in my code as suggest by you

return subconfirm()

but after that problem is same. IT is not working.Because when i am clicking on cancel button this is also going to submit the information but this should not be submit when i am clicking cancel button.

Please help me to solve this.
thanks

'return subconfirm()' will not work in anchor object.

Try this

function subconfirm() {

            if (confirm("Are you sure to submit these details from database?")) {
                window.location = 'addlink.php?id=<?=$row[ID]?>';

            }
        }
<a href="#" onclick=" return subconfirm()">SUBMIT</a>

hi everyone over there ,, pls any one can help for delete Button ,, i want del from database

This article has been dead for over six months. Start a new discussion instead.