1

I have a database with "Products" in it. And on the front end of the website I have a link next to each product that says "move to trash".

When someone click on this link <a href="#">more to trash</a> I want to move that particular product with id=2 to "trash" table. How to perform a query so it moves that particular product to "trash" table width product Id and Name?

nasty
  • 6,477
  • 9
  • 34
  • 52
  • 2
    Your question is too vague. What have you read about or implemented so far, and how did it work for you? Please experiment. – Dai Sep 28 '12 at 00:53

2 Answers2

1

Pass the variable via POST and recuperate it (sanitized of course) on that script. Something like:

my_script.php?item_no=2&action=trash

Really, there's nothing much to it in my opinion.

ApplePie
  • 8,526
  • 5
  • 37
  • 58
1

You could use ajax to run a php script which would execute the database query.

Here's how to trigger a php script using javascript and ajax: How do I run PHP code when a user clicks on a link?

Community
  • 1
  • 1
akronymn
  • 2,397
  • 4
  • 24
  • 37