This line:
mysqli_query("DELETE FROM registered WHERE id=$id",$db);
the connection comes first in mysqli_ and not last.
mysqli_query($db, "DELETE FROM registered WHERE id=$id");
mixed mysqli_query ( mysqli $link , string $query [, int $resultmode = MYSQLI_STORE_RESULT ] )
You could also do it all in one go, without using mysqli_select_db
$db = mysqli_connect("localhost", "root", "", "mydb");
You should also use conditional statements along with isset() and empty().
Also make sure the id being passed through is an int. Otherwise, you will need to quote it.
I.e.:
mysqli_query($db, "DELETE FROM registered WHERE id='$id'");
Sidenote: Your present code is open to SQL injection. Use mysqli with prepared statements, or PDO with prepared statements, they're much safer.
Make use of error reporting/checking for both PHP and MySQL.
Consult:
Edit:
Do the following:
mysqli_query($db, "DELETE FROM registered WHERE id='$id'")
or die(mysqli_error($db));
to see if errors come of it from your query.
Add error reporting to the top of your file(s) which will help find errors.
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
Edit #2:
Replace:
$id=$_POST['idelete'];
mysqli_query("DELETE FROM registered WHERE id=$id",$db);
with:
if(!empty($_POST['idelete'])){
$id=$_POST['idelete'];
}
$query = "DELETE FROM registered WHERE id=$id";
$result = mysqli_query($db, $query);
if ( !$result ) {
trigger_error('query failed', E_USER_ERROR);
}
and see if any errors come of it.
<?php error_reporting(E_ALL); ini_set('display_errors', 1);then the rest of your code, to see if it yields anything.ideletefield have the right ID to delete? Are the values (host, username, password and database name) inside your connection correct?