Jump to content

Help with delete button warning message


php_newB

Recommended Posts

Hi I am trying to attach a warning message to a delete buttton. so if the user click on delete article it will prompt a warning message and ask for confirmation. I have the following javascript in the main page to get the article information:

 

<script language="JavaScript">
function delArticle(id, title)
{
   if (confirm("Are you sure you want to delete '" + title + "'"))
   {
      window.location.href = 'http://localhost/delete.php';
   }
}
</script>

   

 

then I have delete button which calls delete.php (where I coded delete function) to execute delete function. where should I include the javascript code to call the delArticle() function?

is there any way that I can call this from my delete.php file? like somehow include this:

 

javascript:delArticle('<?php echo $id;?>', 
'<?php echo $title;?>'

 

in there.

 

 

many thanks... 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.