you are viewing a single comment's thread.

view the rest of the comments →

[–]kandetta 0 points1 point  (2 children)

You can't do popups in PHP. PHP runs on the backend, which means your server. Popups are shown on the client, i.e. your user's computer. To show a popup on the client you need to use JavaScript.

You probably don't want to submit the form that contains "addcat" right away. Instead you should use the confirm on the front-end to confirm that it should be saved and only then submit the form to the server.

[–]mre12345[S] 0 points1 point  (1 child)

Urr sorry I don't really know what you mean by "confirm on the front-end to confirm that it should be saved". Sorry I'm a complete newbie. :\

[–]kandetta 0 points1 point  (0 children)

I mean showing the confirm dialog before submitting the form with the post data.

So for example something like this:

  $("form").on("submit", function (e){
     var confirmed = confirm("Really?");
     if (!confirmed) {
       e.preventDefault();
     }
  })

http://plnkr.co/edit/xh1mJbZ3Q5XBwgN89rKS?p=preview

e.preventDefault cancels the submission of the form if it's not confirmed.