i have an error Cannot modify header information - headers already sent , i already check out the answer though , no space before the beginning php , and using ob_start and flush ..
its worked on my other php file (insert , edit ) , but its not working only on delete script , but actually the line i want to delete is deleted ..
this is my page to call the code
<script>
function confirmation(id){
var message = "are you sure?";
var konfirmasi = confirm(message);
if(konfirmasi == true) {
window.location="index.php?delete_truk="+ id;
}
else {
 }
 }
</script>
<?php 
        $query = "SELECT * FROM truk";
        $sql=mysql_query($query);
    ?>          
        <table class="show_data" id="truk">
            <tr>
                <td>Truk ID</td>
                <td>Tipe</td>
                <td>images</td>
                <td>Deskripsi</td>
                <td>jumlah</td>
                 <td>Delete/Edit</td>
            </tr>
            <?php 
                while($fetch=mysql_fetch_array($sql)){
            ?>
            <tr>
                <td><?php echo $fetch['trukid']; ?></td>
                <td style="width:100px;"><?php echo $fetch['tipe']; ?></td>
                <td><?php echo $fetch['images']; ?></td>
                <td><?php echo substr($fetch['deskripsi'],0,50); ?></td>
                <td><?php echo $fetch['jumlah']; ?></td>
                <td>
                <input type="image" class="icon" src="images/asset/delete.jpg" onClick="confirmation('<?php echo $fetch['trukid']; ?>') ">
                <a href="index.php?edit_truk=<?php echo $fetch['trukid']; ?>"><img class="icon" src="images/asset/edit.jpg"></a>
                </td>
            </tr>
            <?php } ?>
        </table>
        <a href="index.php?input_truk" class="button">Tambah Truk</a>
here is the code
<?php
$id = $_GET['delete_truk'];
$sql="DELETE FROM `truk` WHERE `trukid` = '$id' ";
$query = mysql_query($sql);
header('Location:index.php?truck');
?>
and it cannot redirect instead Warning: Cannot modify header information - headers already sent by (output started
thanks for your help ,, sorry for bad english
 
    