} elseif(isset($_SESSION['user_id']) AND isset($_POST['delete'])){
$connect=db_connect_2();
foreach($_POST['checkbox'] as $check)
{
$delete = mysqli_query("DELETE FROM mailing_list WHERE id = '$check'");
}
$body = "mailingList.php";
}
Error pops up:
Warning: Invalid argument supplied for foreach()
Of course no entries are deleted due to this warning.
If you have Teamviewer installed PM me your connection details within 60 minutes of this post and I’ll hop over to your desktop and debug this with you.
If you have Teamviewer installed PM me your connection details within 60 minutes of this post and I’ll hop over to your desktop and debug this with you.
Sorry tangoforce I don’t have Teamviewer installed but it would be best if you could just help me fix my codes in your reply =)
You create a new form for each entry? So each form has only one checkbox?
Your forms have no submit button?
You give the checkbox the value of $rows[‘id’], and that should be (I think) $row[‘id’]
Yes since i am using a while loop, so there is a checkbox near each entry respectively as usual
There’s one delete (submit) button above the table
Yes it should be $row[‘id’], good point. But still the same warning pops up
A checkbox near each entry, ok. But all checkboxes should be part of one single form.
There’s one delete (submit) button above the table
Above the table, and in another form. That’s why you get the error. Clicking that button, you send that form and that form contains only the button. No other data (since all checkboxes have their own forms that will never be sent).
Put the button and all checkboxes in one form and see what happens.
Thats why I offered assistance. TV is a free download if you’d spent 20 seconds to google it
Nevermind, you made it clear you’d prefer to spend hours waiting for replies etc so I’ll leave you to it. FYI, most people I’ve offered that kind of help to have jumped at it.
As you can see, I deleted the two </form>'s you had, and added a new one at the end. I also deleted the hidden field with the id. It’s useless, because you get that value from $_POST[‘checkbox’].