As I mentioned in comments, you're outputting before headers (see "References" below). There should not be any output before that, including one or more spaces before the opening <?php
tag, HTML, cookies, etc., or anything that would cause an error.
This is covered in the link I have provided for you below, under "References".
- Remove the "echo" statement.
Whether you saw my comment or not is unknownst to me, and am submitting the following answer.
If error reporting were set/on on your server, you would be receiving a warning similar to this:
Warning: Cannot modify header information - headers already sent by (output started at /var/user/you/folder/adminpanel.php:12) in /var/user/you/folder/adminpanel.php on line x
Tested with the following and added some code that you left out in your question, proved to be successful.
<?php
$op = $_GET['op'];
if($op == 'edit')
{
$id = $_GET['id'];
header("location:adminpanel.php?type=edit");
exit;
}
Sidenote: It's best to add exit;
after header, should there be more code following that. Otherwise, your code may want to continue executing.
References:
Error reporting:
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);
// rest of your code
Sidenote: Error reporting should only be done in staging, and never production.