javascript - PHP call to header() function is not working -
this question has answer here:
- how fix “headers sent” error in php 11 answers
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
Post a Comment