Delete values selected using checkbox

前端 未结 2 1028
有刺的猬
有刺的猬 2020-12-22 13:40

I want to delete values that has been selected using checkbox. I am using this script though its not giving any error but its not working

please help it out.

<
相关标签:
2条回答
  • 2020-12-22 14:31

    Check the name of your delete button. $_POST['delete'] needs the name to be 'delete'.

    Also please check $del_id = $checkbox['$i']; It should be $del_id = $checkbox[$i];

    And for security sake

    $sql = "DELETE FROM t_s_list WHERE s_id='".mysql_real_escape_string($del_id)."'";
    
    0 讨论(0)
  • 2020-12-22 14:33

    You write:

    <input type="submit" name="Submit" value="Delete">
    

    but

    $_POST['delete']
    

    Use var_dump($_POST) to see what the issue is here, if you don't see it.

    Also, where is your SQL Injection protection?

    0 讨论(0)
提交回复
热议问题