• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 274
  • Last Modified:

records deleting before clicking delete

I have some checkboxes and a user is meant to click the checkboxes for the items they want to delete. However, at the moment it automatically deletes everything before the page even loads so you can't actually click on anything because there are no records as it deletes everything!

if (isset($_POST['Delete'])){
  foreach ($_POST['prodsizeid'] as $delete_id){
  $deleteSQL = sprintf("DELETE FROM sizes WHERE sizeid = $delete_id AND productid =%s",
  GetSQLValueString($_GET['ProductID'], "text"));
  $result = mysql_query($query, $test);

Open in new window

0
jonofat
Asked:
jonofat
1 Solution
 
Tyler LaczkoCommented:
update your if to $_POST['delete'] == "your delete button value"

you also need to check is $_POST['prodsizeid']  is checked change your form from POST to GET and it will help you out.

after you have it working with GET change back to POST
0
 
jonofatAuthor Commented:
Sorted it out, thanks.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now