javascript - PHP call to header() function is not working -


this question has answer here:

i trying change page using php after set session variable. calling function code

 echo "<a href='index.php?id=";            echo $row['id'];           echo "'><img src='images/pic_1.jpg' 

the function called , variable set page never redirects

    <?php         function getid() {  echo $_get['id'];  session_start();  header("location: home.php");  $_session['id'] = $_get['id'];    }      if (isset($_get['id'])) {      getid();    }              ?>    

i have tried both using exact url , file name none work. how have both page redirect , $_session['id'] variable work?

response headers have sent before response body in http. code contains echo statement (which starts sending body) before call header(), sending headers cannot work.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -