i have a form in one page thet leads me to another page .

when i want to delete a page in my cms , i am click on the icon that is leads me
to page called delete.php.

i want that when i click the icon the option will be in the same page as
for exemple: index.php=delete

how do i creating this option in the same page

A form can only have one action. If the form HTML is:

<form action="index.php?do=delete">

then that entire form must be processed by that action. (You can use some Javascript to circumvent that, but then it starts getting tricky.)

ok, but i want that Instead of having the delete.php
that i have all the delete file in my index.php file
and when i click the icon on the index file the function of delete from the data base
will be in the index .php insted of delete.php

Member Avatar

I strongly suggest you don't have this in the same file. Have your delete stuff in your delete page. Otherwise you end up placing the whole site into one page - not very good. Also, you can replay form submission on page refresh - again not good. So, always try to send your forms to other pages as opposed to the same one.

The usual approach is:

index.php (form) -> delete.php (do deletes) then header() -> index.php

However, you can use Ajax to do the server stuff and update your html without leaving the page (no refresh). Again this is a pretty common approach.