0

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

exemple:
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

3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by diafol
0

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.)

0

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

Edited by matanc244

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.