hello everyone i m writing code for deleting data, but i have a problem in that,
well the scenario is like this:
i have three pages, my pages has two submit buttons and on action i m calling the delete.php (my delete.php is one file in which i am checking for post, ie.
these two works fine for me, but my third page has two buttons (not submit) one for delete one for approve, so i cannot redirect to delete.php using form action,
so i m redirecting from here to delete.php with js, and also i m passing the id number with url, whose record want to delete...
now my question is how to check post for this in delete.php
if i do like this:
//code for delete whose button name is button3
if i do like this it's an error because i m not using post here, so how to do this???
I think that you are mixing up funjctionality with web pages. Instead, try this: have a web page for each different type of data that you want to display/input, and define a PHP page for each. Then have separate php include pages that know how to do things such as update the database, query the database, delete things in the database. The form input should lead to a php file that knows how to process the input. That file should examine the button clicked and invoke the correct funtions in the pages that perform the database handling.
What books have you read about PHP so far? Most should really cover this topic with various best practices.
posted 8 years ago
this i have also done, i have created one more page say delete1.php for the page in which i have two buttons, and i m passing my id Id to delete1.php by url and getting id in delete1.php and performing query based on that id..
but now anyone can change id into url and operation/query will perform because posting of data is not check here..
look! it's a bird! it's a plane! It's .... a teeny tiny ad