I want my page to automatically redirect to another page when the data is fetch on the page so how can I do it ? i have this code
here is my code here is where the data is fetched but once it fetch i want to redirect it automatically.
<div>
<?php
$data = mysqli_query($con,"SELECT * FROM announcement");
$count = mysqli_num_rows($data);
if ($count != 0) {
//IVE ASSUMED THAT THIS WILL WORK BUT IT DIDNT
header("location:../addRedirect.php");
while($row = mysqli_fetch_array($data)) {
echo '<div id="myModal" class="modal" style="position:fixed; display: none; padding-top: 100px;
left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgb(0,0,0); background-color: rgba(0,0,0,0.9); ">
<div class="container" style="width: 100%">
<div class="card col-12" style="background-color: red; color: white;">
<div class="card-header">
<p><h3 class="text-center">Announcement</h3></p>
</div>
<div class="card-body text-center">
<h5>'.$row['additional_info'].'</h5>
<p>Please click refresh button to resume after the announcement</p>
</div>
</div>
</div>
<img class="modal-content" id="img01">
</div>';
$dataid = $row['id'];
}
}
?>
</div>
and on my second page i want to redirect it back.. so what i have is an auto refresh when im just fetching data.. thanks guide me pls this is a huge help for me as a starter of php and codings thanks.
<?php
header("location:../home.php");
?>