Pawan_Agarwal Posted July 12, 2013 Share Posted July 12, 2013 I am trying to access the values from "first.php" page to "visit.php", I am able to get the values , however, while creating and destroying cookies, I am facing error. ----------------FIRST.PHP---------------- <?php error_reporting(E_ALL); if(isset($_COOKIE["_user_name"])){ setcookie("_user_name", "", time()-(3600*1000)); echo $_COOKIE["_user_name"]; } ?> <form method='post' action="visit.php"> <input type="text" name="name1"/> <input type="submit" value="Submit"/> </form> ----------------FIRST.PHP---------------- ----------------VISIT.PHP---------------- <?php error_reporting(E_ALL); if(isset($_POST["name1"])) { $name = $_REQUEST["name1"]; echo "Value = ".$name; setcookie("_user_name", $name, time()+3600); } ?> ----------------VISIT.PHP---------------- When I enter name on "FIRST.PHP", I am able to access it on "VISIT.PHP", but I am facing waring Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\counter\visit.php:6) in C:\xampp\htdocs\counter\visit.php on line 7 I am deleting the existing cookie on "FIRST.PHP" and then accessing value from "FIRST.PHP" to "VISIT.PHP", I am trying to create cookie on "VISIT.PHP"..... Can you help me in getting the warning removed ??? Link to comment https://forums.phpfreaks.com/topic/280096-cookie-issue-while-accessing-on-another-page/ Share on other sites More sharing options...
boompa Posted July 12, 2013 Share Posted July 12, 2013 See the FAQ (Frequently Asked Questions) topic. Link to comment https://forums.phpfreaks.com/topic/280096-cookie-issue-while-accessing-on-another-page/#findComment-1440439 Share on other sites More sharing options...
ShivaGupta Posted July 12, 2013 Share Posted July 12, 2013 @ boompa this is not a nice reply ...at the search we will find all answers but we want quik reply.........so if u able post here otherwise ................. Link to comment https://forums.phpfreaks.com/topic/280096-cookie-issue-while-accessing-on-another-page/#findComment-1440501 Share on other sites More sharing options...
Pawan_Agarwal Posted July 18, 2013 Author Share Posted July 18, 2013 I did it by some way out !! Link to comment https://forums.phpfreaks.com/topic/280096-cookie-issue-while-accessing-on-another-page/#findComment-1441255 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.