0

I have used window.open inside the php code because i cannot be able to use multiple headers inside the php code that is why i have used window.open() of javascript the problem is that chrome and other browsers blocked popup. so i need to sort out this solution this is my php code

<?php 
    error_reporting(0);


    $status="";

    if(isset($_POST['btnUpdate'])){ 
    $genid=$_POST['creategenReport'];
    $startdate=$_POST['sDate'];
    $enddate=$_POST['eDate'];
    $query=mysqli_query($con,"SELECT  * FROM generatorrun WHERE startTime BETWEEN '$startdate %:%:%' AND '$enddate %:%:%' AND generatorId='$genid'") or die("query failed");
    $noofRows=mysqli_num_rows($query);
    if($noofRows>=1){
    $status=true;
    echo '<script>window.open("reportConsumption.php?creategenReport='.$genid.'&sDate='.$startdate.'&eDate='.$enddate.'","_blank","top=0,left=0");</script>';



    }else{
    $status=false;
    $message="No Record Found !";

     echo '<script>alert("No Record Found");</script>';


    }
    }


  ?>

the code is working properly but the problem is that browsers dont allow popup. i need to open this page into new window that is why i am using window.open()

hotshot code
  • 173
  • 1
  • 10

0 Answers0