session destroy after search results shownHow do I expire a PHP session after 30 minutes?mysql_fetch_array()/mysql_fetch_assoc()/mysql_fetch_row()/mysql_num_rows etc… expects parameter 1 to be resource or resultPHP Sessions: Explanation please?Check if PHP session has already startedPHP5 $_SESSION not working while register_globals is offIssues With PHP SessionForm isn't picking up the variables to postusing sessions to post data into input using what ifWhy is my array of arrays not being called when the $_SESSION is changed to TRUE?search specific node into an xml file
Is there a distance limit for minecart tracks?
What is the meaning of "You've never met a graph you didn't like?"
Isometric embedding of a genus g surface
What (the heck) is a Super Worm Equinox Moon?
How do I Interface a PS/2 Keyboard without Modern Techniques?
What is this high flying aircraft over Pennsylvania?
When and why was runway 07/25 at Kai Tak removed?
Should I assume I have passed probation?
Personal or impersonal in a technical resume
ContourPlot — How do I color by contour curvature?
Telemetry for feature health
How can I, as DM, avoid the Conga Line of Death occurring when implementing some form of flanking rule?
How to get directions in deep space?
Has the laser at Magurele, Romania reached a tenth of the Sun's power?
Proving an identity involving cross products and coplanar vectors
Animation: customize bounce interpolation
Why does a 97 / 92 key piano exist by Bösendorfer?
How to leave product feedback on macOS?
Typing CO_2 easily
Is there a RAID 0 Equivalent for RAM?
Does the Crossbow Expert feat's extra crossbow attack work with the reaction attack from a Hunter ranger's Giant Killer feature?
Are Captain Marvel's powers affected by Thanos breaking the Tesseract and claiming the stone?
Limit max CPU usage SQL SERVER with WSRM
Giving feedback to someone without sounding prejudiced
session destroy after search results shown
How do I expire a PHP session after 30 minutes?mysql_fetch_array()/mysql_fetch_assoc()/mysql_fetch_row()/mysql_num_rows etc… expects parameter 1 to be resource or resultPHP Sessions: Explanation please?Check if PHP session has already startedPHP5 $_SESSION not working while register_globals is offIssues With PHP SessionForm isn't picking up the variables to postusing sessions to post data into input using what ifWhy is my array of arrays not being called when the $_SESSION is changed to TRUE?search specific node into an xml file
I had my web application and it has (registration form, adding info, viewing info, and search and all these choices in the same page in navbar menu )
I start session for each user(when log in) and every thing is OK till I search for something and I got the search result and I go to the add or view info I found that is logged out that is mean the session destroyed why this is happened ? I want user to be logged in even after I finish search pleas help me and apologize if I have mistaken.
this is my code for the search part :
<form class="navbar-form navbar-left" action="" method="post">
<div class="input-group">
<input size=55 type="text" name="search" class="form-control" placeholder="Search">
<span class="input-group-btn">
<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-search"></span></button>
</span>
</div>
</form>
</nav>
</div>
<?php
if(!isset($_SESSION))session_start();
$conn = mysql_connect("localhost", "root", '');
mysql_select_db("db103",$conn);
$user=$_SESSION["myname"];
$fname = '';
if (isset($_POST['search']))
$fname = $_POST['search'];
else
if(isset($_SESSION["myname"]))
$sql = "SELECT * FROM telephone_guide where owner='$user' and (firstName like '%$fname%' or secondName like '%$fname%' or phonenumber like '%$fname%' or celnumber like '%$fname%')";
$result = mysql_query($sql, $conn) ;
// number of rows fetched
$num = mysql_num_rows($result);
echo("<div class='styl'>");
echo("<table width=300 border=3 >");
echo("<th>ID<th>First Name<th>Second Name<th>tele-Phone Number<th>cel_phone number<th>Date<th>Address");
while ($arr = mysql_fetch_array($result))
echo("<tr><td><a href='update1.php?id1=$arr[0]'>$arr[0]</td><td>$arr[2]</td><td>$arr[3]</td><td>$arr[4]</td><td>$arr[5]</td><td>$arr[6]</td><td>$arr[7]</td></tr>");
echo("</table>");
?>
<br>
<br>
<?php
echo("</div>");
?>
php session
add a comment |
I had my web application and it has (registration form, adding info, viewing info, and search and all these choices in the same page in navbar menu )
I start session for each user(when log in) and every thing is OK till I search for something and I got the search result and I go to the add or view info I found that is logged out that is mean the session destroyed why this is happened ? I want user to be logged in even after I finish search pleas help me and apologize if I have mistaken.
this is my code for the search part :
<form class="navbar-form navbar-left" action="" method="post">
<div class="input-group">
<input size=55 type="text" name="search" class="form-control" placeholder="Search">
<span class="input-group-btn">
<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-search"></span></button>
</span>
</div>
</form>
</nav>
</div>
<?php
if(!isset($_SESSION))session_start();
$conn = mysql_connect("localhost", "root", '');
mysql_select_db("db103",$conn);
$user=$_SESSION["myname"];
$fname = '';
if (isset($_POST['search']))
$fname = $_POST['search'];
else
if(isset($_SESSION["myname"]))
$sql = "SELECT * FROM telephone_guide where owner='$user' and (firstName like '%$fname%' or secondName like '%$fname%' or phonenumber like '%$fname%' or celnumber like '%$fname%')";
$result = mysql_query($sql, $conn) ;
// number of rows fetched
$num = mysql_num_rows($result);
echo("<div class='styl'>");
echo("<table width=300 border=3 >");
echo("<th>ID<th>First Name<th>Second Name<th>tele-Phone Number<th>cel_phone number<th>Date<th>Address");
while ($arr = mysql_fetch_array($result))
echo("<tr><td><a href='update1.php?id1=$arr[0]'>$arr[0]</td><td>$arr[2]</td><td>$arr[3]</td><td>$arr[4]</td><td>$arr[5]</td><td>$arr[6]</td><td>$arr[7]</td></tr>");
echo("</table>");
?>
<br>
<br>
<?php
echo("</div>");
?>
php session
1
** Note: To use cookie-based sessions, session_start() must be called before outputting anything to the browser. **
– tim
Mar 7 at 22:09
As @tim said, use session_start(); in top of the codes, one time, such a way that run in every pages in your website.
– iazaran
Mar 7 at 22:27
add a comment |
I had my web application and it has (registration form, adding info, viewing info, and search and all these choices in the same page in navbar menu )
I start session for each user(when log in) and every thing is OK till I search for something and I got the search result and I go to the add or view info I found that is logged out that is mean the session destroyed why this is happened ? I want user to be logged in even after I finish search pleas help me and apologize if I have mistaken.
this is my code for the search part :
<form class="navbar-form navbar-left" action="" method="post">
<div class="input-group">
<input size=55 type="text" name="search" class="form-control" placeholder="Search">
<span class="input-group-btn">
<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-search"></span></button>
</span>
</div>
</form>
</nav>
</div>
<?php
if(!isset($_SESSION))session_start();
$conn = mysql_connect("localhost", "root", '');
mysql_select_db("db103",$conn);
$user=$_SESSION["myname"];
$fname = '';
if (isset($_POST['search']))
$fname = $_POST['search'];
else
if(isset($_SESSION["myname"]))
$sql = "SELECT * FROM telephone_guide where owner='$user' and (firstName like '%$fname%' or secondName like '%$fname%' or phonenumber like '%$fname%' or celnumber like '%$fname%')";
$result = mysql_query($sql, $conn) ;
// number of rows fetched
$num = mysql_num_rows($result);
echo("<div class='styl'>");
echo("<table width=300 border=3 >");
echo("<th>ID<th>First Name<th>Second Name<th>tele-Phone Number<th>cel_phone number<th>Date<th>Address");
while ($arr = mysql_fetch_array($result))
echo("<tr><td><a href='update1.php?id1=$arr[0]'>$arr[0]</td><td>$arr[2]</td><td>$arr[3]</td><td>$arr[4]</td><td>$arr[5]</td><td>$arr[6]</td><td>$arr[7]</td></tr>");
echo("</table>");
?>
<br>
<br>
<?php
echo("</div>");
?>
php session
I had my web application and it has (registration form, adding info, viewing info, and search and all these choices in the same page in navbar menu )
I start session for each user(when log in) and every thing is OK till I search for something and I got the search result and I go to the add or view info I found that is logged out that is mean the session destroyed why this is happened ? I want user to be logged in even after I finish search pleas help me and apologize if I have mistaken.
this is my code for the search part :
<form class="navbar-form navbar-left" action="" method="post">
<div class="input-group">
<input size=55 type="text" name="search" class="form-control" placeholder="Search">
<span class="input-group-btn">
<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-search"></span></button>
</span>
</div>
</form>
</nav>
</div>
<?php
if(!isset($_SESSION))session_start();
$conn = mysql_connect("localhost", "root", '');
mysql_select_db("db103",$conn);
$user=$_SESSION["myname"];
$fname = '';
if (isset($_POST['search']))
$fname = $_POST['search'];
else
if(isset($_SESSION["myname"]))
$sql = "SELECT * FROM telephone_guide where owner='$user' and (firstName like '%$fname%' or secondName like '%$fname%' or phonenumber like '%$fname%' or celnumber like '%$fname%')";
$result = mysql_query($sql, $conn) ;
// number of rows fetched
$num = mysql_num_rows($result);
echo("<div class='styl'>");
echo("<table width=300 border=3 >");
echo("<th>ID<th>First Name<th>Second Name<th>tele-Phone Number<th>cel_phone number<th>Date<th>Address");
while ($arr = mysql_fetch_array($result))
echo("<tr><td><a href='update1.php?id1=$arr[0]'>$arr[0]</td><td>$arr[2]</td><td>$arr[3]</td><td>$arr[4]</td><td>$arr[5]</td><td>$arr[6]</td><td>$arr[7]</td></tr>");
echo("</table>");
?>
<br>
<br>
<?php
echo("</div>");
?>
php session
php session
edited Mar 7 at 22:17
Shadow
26k93046
26k93046
asked Mar 7 at 22:03
raghadraghad
21
21
1
** Note: To use cookie-based sessions, session_start() must be called before outputting anything to the browser. **
– tim
Mar 7 at 22:09
As @tim said, use session_start(); in top of the codes, one time, such a way that run in every pages in your website.
– iazaran
Mar 7 at 22:27
add a comment |
1
** Note: To use cookie-based sessions, session_start() must be called before outputting anything to the browser. **
– tim
Mar 7 at 22:09
As @tim said, use session_start(); in top of the codes, one time, such a way that run in every pages in your website.
– iazaran
Mar 7 at 22:27
1
1
** Note: To use cookie-based sessions, session_start() must be called before outputting anything to the browser. **
– tim
Mar 7 at 22:09
** Note: To use cookie-based sessions, session_start() must be called before outputting anything to the browser. **
– tim
Mar 7 at 22:09
As @tim said, use session_start(); in top of the codes, one time, such a way that run in every pages in your website.
– iazaran
Mar 7 at 22:27
As @tim said, use session_start(); in top of the codes, one time, such a way that run in every pages in your website.
– iazaran
Mar 7 at 22:27
add a comment |
1 Answer
1
active
oldest
votes
You will need to initialize session before anything
You can also see ob_start() and ob_flush_end() at the very end of your script. This is to suppress errors arising from packets already sent due to intercalation html within php
So try This
<?php
ob_start();
session_start();
?>
<form class="navbar-form navbar-left" action="" method="post">
<div class="input-group">
<input size=55 type="text" name="search" class="form-control" placeholder="Search">
<span class="input-group-btn">
<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-search"></span></button>
</span>
</div>
</form>
</nav>
</div>
<?php
if(isset($_SESSION))
$conn = mysql_connect("localhost", "root", '');
mysql_select_db("db103",$conn);
$user=$_SESSION["myname"];
$fname = '';
if (isset($_POST['search']))
$fname = $_POST['search'];
else
if(isset($_SESSION["myname"]))
$sql = "SELECT * FROM telephone_guide where owner='$user' and (firstName like '%$fname%' or secondName like '%$fname%' or phonenumber like '%$fname%' or celnumber like '%$fname%')";
$result = mysql_query($sql, $conn) ;
// number of rows fetched
$num = mysql_num_rows($result);
echo("<div class='styl'>");
echo("<table width=300 border=3 >");
echo("<th>ID<th>First Name<th>Second Name<th>tele-Phone Number<th>cel_phone number<th>Date<th>Address");
while ($arr = mysql_fetch_array($result))
echo("<tr><td><a href='update1.php?id1=$arr[0]'>$arr[0]</td><td>$arr[2]</td><td>$arr[3]</td><td>$arr[4]</td><td>$arr[5]</td><td>$arr[6]</td><td>$arr[7]</td></tr>");
echo("</table>");
?>
<br>
<br>
<?php
echo("</div>");
?>
<?php ob_end_flush(); ?>
" This is to suppress errors" sure why fix errors, when we can just pretend they never happened.
– tim
Mar 8 at 0:28
hahaha I just lost two point
– Nancy Mooree
Mar 8 at 5:57
@NancyMooree sorry but it does not work with me it still log out after I got results search :(
– raghad
Mar 9 at 14:48
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55053516%2fsession-destroy-after-search-results-shown%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You will need to initialize session before anything
You can also see ob_start() and ob_flush_end() at the very end of your script. This is to suppress errors arising from packets already sent due to intercalation html within php
So try This
<?php
ob_start();
session_start();
?>
<form class="navbar-form navbar-left" action="" method="post">
<div class="input-group">
<input size=55 type="text" name="search" class="form-control" placeholder="Search">
<span class="input-group-btn">
<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-search"></span></button>
</span>
</div>
</form>
</nav>
</div>
<?php
if(isset($_SESSION))
$conn = mysql_connect("localhost", "root", '');
mysql_select_db("db103",$conn);
$user=$_SESSION["myname"];
$fname = '';
if (isset($_POST['search']))
$fname = $_POST['search'];
else
if(isset($_SESSION["myname"]))
$sql = "SELECT * FROM telephone_guide where owner='$user' and (firstName like '%$fname%' or secondName like '%$fname%' or phonenumber like '%$fname%' or celnumber like '%$fname%')";
$result = mysql_query($sql, $conn) ;
// number of rows fetched
$num = mysql_num_rows($result);
echo("<div class='styl'>");
echo("<table width=300 border=3 >");
echo("<th>ID<th>First Name<th>Second Name<th>tele-Phone Number<th>cel_phone number<th>Date<th>Address");
while ($arr = mysql_fetch_array($result))
echo("<tr><td><a href='update1.php?id1=$arr[0]'>$arr[0]</td><td>$arr[2]</td><td>$arr[3]</td><td>$arr[4]</td><td>$arr[5]</td><td>$arr[6]</td><td>$arr[7]</td></tr>");
echo("</table>");
?>
<br>
<br>
<?php
echo("</div>");
?>
<?php ob_end_flush(); ?>
" This is to suppress errors" sure why fix errors, when we can just pretend they never happened.
– tim
Mar 8 at 0:28
hahaha I just lost two point
– Nancy Mooree
Mar 8 at 5:57
@NancyMooree sorry but it does not work with me it still log out after I got results search :(
– raghad
Mar 9 at 14:48
add a comment |
You will need to initialize session before anything
You can also see ob_start() and ob_flush_end() at the very end of your script. This is to suppress errors arising from packets already sent due to intercalation html within php
So try This
<?php
ob_start();
session_start();
?>
<form class="navbar-form navbar-left" action="" method="post">
<div class="input-group">
<input size=55 type="text" name="search" class="form-control" placeholder="Search">
<span class="input-group-btn">
<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-search"></span></button>
</span>
</div>
</form>
</nav>
</div>
<?php
if(isset($_SESSION))
$conn = mysql_connect("localhost", "root", '');
mysql_select_db("db103",$conn);
$user=$_SESSION["myname"];
$fname = '';
if (isset($_POST['search']))
$fname = $_POST['search'];
else
if(isset($_SESSION["myname"]))
$sql = "SELECT * FROM telephone_guide where owner='$user' and (firstName like '%$fname%' or secondName like '%$fname%' or phonenumber like '%$fname%' or celnumber like '%$fname%')";
$result = mysql_query($sql, $conn) ;
// number of rows fetched
$num = mysql_num_rows($result);
echo("<div class='styl'>");
echo("<table width=300 border=3 >");
echo("<th>ID<th>First Name<th>Second Name<th>tele-Phone Number<th>cel_phone number<th>Date<th>Address");
while ($arr = mysql_fetch_array($result))
echo("<tr><td><a href='update1.php?id1=$arr[0]'>$arr[0]</td><td>$arr[2]</td><td>$arr[3]</td><td>$arr[4]</td><td>$arr[5]</td><td>$arr[6]</td><td>$arr[7]</td></tr>");
echo("</table>");
?>
<br>
<br>
<?php
echo("</div>");
?>
<?php ob_end_flush(); ?>
" This is to suppress errors" sure why fix errors, when we can just pretend they never happened.
– tim
Mar 8 at 0:28
hahaha I just lost two point
– Nancy Mooree
Mar 8 at 5:57
@NancyMooree sorry but it does not work with me it still log out after I got results search :(
– raghad
Mar 9 at 14:48
add a comment |
You will need to initialize session before anything
You can also see ob_start() and ob_flush_end() at the very end of your script. This is to suppress errors arising from packets already sent due to intercalation html within php
So try This
<?php
ob_start();
session_start();
?>
<form class="navbar-form navbar-left" action="" method="post">
<div class="input-group">
<input size=55 type="text" name="search" class="form-control" placeholder="Search">
<span class="input-group-btn">
<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-search"></span></button>
</span>
</div>
</form>
</nav>
</div>
<?php
if(isset($_SESSION))
$conn = mysql_connect("localhost", "root", '');
mysql_select_db("db103",$conn);
$user=$_SESSION["myname"];
$fname = '';
if (isset($_POST['search']))
$fname = $_POST['search'];
else
if(isset($_SESSION["myname"]))
$sql = "SELECT * FROM telephone_guide where owner='$user' and (firstName like '%$fname%' or secondName like '%$fname%' or phonenumber like '%$fname%' or celnumber like '%$fname%')";
$result = mysql_query($sql, $conn) ;
// number of rows fetched
$num = mysql_num_rows($result);
echo("<div class='styl'>");
echo("<table width=300 border=3 >");
echo("<th>ID<th>First Name<th>Second Name<th>tele-Phone Number<th>cel_phone number<th>Date<th>Address");
while ($arr = mysql_fetch_array($result))
echo("<tr><td><a href='update1.php?id1=$arr[0]'>$arr[0]</td><td>$arr[2]</td><td>$arr[3]</td><td>$arr[4]</td><td>$arr[5]</td><td>$arr[6]</td><td>$arr[7]</td></tr>");
echo("</table>");
?>
<br>
<br>
<?php
echo("</div>");
?>
<?php ob_end_flush(); ?>
You will need to initialize session before anything
You can also see ob_start() and ob_flush_end() at the very end of your script. This is to suppress errors arising from packets already sent due to intercalation html within php
So try This
<?php
ob_start();
session_start();
?>
<form class="navbar-form navbar-left" action="" method="post">
<div class="input-group">
<input size=55 type="text" name="search" class="form-control" placeholder="Search">
<span class="input-group-btn">
<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-search"></span></button>
</span>
</div>
</form>
</nav>
</div>
<?php
if(isset($_SESSION))
$conn = mysql_connect("localhost", "root", '');
mysql_select_db("db103",$conn);
$user=$_SESSION["myname"];
$fname = '';
if (isset($_POST['search']))
$fname = $_POST['search'];
else
if(isset($_SESSION["myname"]))
$sql = "SELECT * FROM telephone_guide where owner='$user' and (firstName like '%$fname%' or secondName like '%$fname%' or phonenumber like '%$fname%' or celnumber like '%$fname%')";
$result = mysql_query($sql, $conn) ;
// number of rows fetched
$num = mysql_num_rows($result);
echo("<div class='styl'>");
echo("<table width=300 border=3 >");
echo("<th>ID<th>First Name<th>Second Name<th>tele-Phone Number<th>cel_phone number<th>Date<th>Address");
while ($arr = mysql_fetch_array($result))
echo("<tr><td><a href='update1.php?id1=$arr[0]'>$arr[0]</td><td>$arr[2]</td><td>$arr[3]</td><td>$arr[4]</td><td>$arr[5]</td><td>$arr[6]</td><td>$arr[7]</td></tr>");
echo("</table>");
?>
<br>
<br>
<?php
echo("</div>");
?>
<?php ob_end_flush(); ?>
answered Mar 7 at 22:41
Nancy MooreeNancy Mooree
53828
53828
" This is to suppress errors" sure why fix errors, when we can just pretend they never happened.
– tim
Mar 8 at 0:28
hahaha I just lost two point
– Nancy Mooree
Mar 8 at 5:57
@NancyMooree sorry but it does not work with me it still log out after I got results search :(
– raghad
Mar 9 at 14:48
add a comment |
" This is to suppress errors" sure why fix errors, when we can just pretend they never happened.
– tim
Mar 8 at 0:28
hahaha I just lost two point
– Nancy Mooree
Mar 8 at 5:57
@NancyMooree sorry but it does not work with me it still log out after I got results search :(
– raghad
Mar 9 at 14:48
" This is to suppress errors" sure why fix errors, when we can just pretend they never happened.
– tim
Mar 8 at 0:28
" This is to suppress errors" sure why fix errors, when we can just pretend they never happened.
– tim
Mar 8 at 0:28
hahaha I just lost two point
– Nancy Mooree
Mar 8 at 5:57
hahaha I just lost two point
– Nancy Mooree
Mar 8 at 5:57
@NancyMooree sorry but it does not work with me it still log out after I got results search :(
– raghad
Mar 9 at 14:48
@NancyMooree sorry but it does not work with me it still log out after I got results search :(
– raghad
Mar 9 at 14:48
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55053516%2fsession-destroy-after-search-results-shown%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
** Note: To use cookie-based sessions, session_start() must be called before outputting anything to the browser. **
– tim
Mar 7 at 22:09
As @tim said, use session_start(); in top of the codes, one time, such a way that run in every pages in your website.
– iazaran
Mar 7 at 22:27