Hi people!
I' m understanding sessions right now and I would like some help to achieve this goal:
I want to pass the variable of a search from the "results page" to another page.
I want to include the results from my search engine into a session so if I start the session in any other page I get the results.
So this is what I´ve done
search.php ---->
<form method="POST" action="result.php">
<input name="name" type="text" >
<input name="submit" type="submit" value="search">
</form>
result.php-->
<?php
session_start();
$name = $POST['name'];
$SESSION['name'] = $name;
?>
<?
if (!isset($Search)){
echo "You need to specify a search criteria";
exit;
}
$result = mysql_query("SELECT * FROM mytable WHERE name LIKE '%$name%'");
if (!mysql_num_rows($result)) {
echo "Nothing found";
exit;
} else {
while ($row = mysql_fetch_array($result)) {
$name = $row["name"];
$Photo = $row["Photo"];
?>
__________________________________________>
So now if I move to another page and want this search result with me I just....
anypage.php------>
<?php
session_start();
?>
<? echo $_SESSION['name']; ?>
__________________________________________>
At this moment you probably may say... it´s obvious why this is not working, and if you can post that comment for me I will appreciate it a lot.
Thank U