Passing on unique session variables to the resumerviewer.php page
<?php
//get data
session_start();
$button = $_GET['submit'];
$search = $_GET['search'];
if (!$button)
echo "YOU DIDNT SUBMIT A KEYWORD";
else
{
if (strlen($search)<=2)
echo "SEARCH TERM TOO SHORT";
else
{
echo"You searched for <b>$search</b><hr size='1'>";
//connect to database
include("connect.php");
// a bit of filtering
$search = strtoupper($search);
$search= strip_tags($search);
$search = trim ($search);
$keywords = $getrow['preferedlocation'];
//explode our search term
$search_exploded = explode(" ",$search);
foreach ($search_exploded as $search_each)
{
//construct query
$x++;
if ($x==1)
$construct .= "preferedlocation LIKE '%$search_each%'";
else
$construct .= " OR preferedlocation LIKE '%$search_each%'";
}
//echo 开发者_如何学Cout construct
$construct = "SELECT * FROM jobseekers WHERE $construct";
$run = mysql_query($construct);
$foundnum = mysql_num_rows($run);
if ($foundnum==0)
echo "No results found.";
else
{
echo "$foundnum results found!<p>";
while ($runrows = mysql_fetch_assoc($run))
{
$jobseekerid = $runrows['jobseekerid'];
$jobseekeremail = $runrows['jobseekeremail'];
$jobseekerpassword = $runrows['jobseekerpassword'];
$jobseekertitle = $runrows['jobseekertitle'];
$jobseekerfirstname = $runrows['jobseekerfirstname'];
$jobseekerlastname = $runrows['jobseekerlastname'];
$jobseekeraddress = $runrows['jobseekeraddress'];
$jobseekerphoneno = $runrows['jobseekerphoneno'];
$jobseekerdob = $runrows['jobseekerdob'];
$jobseekergender = $runrows['jobseekergender'];
$imagelocation = $runrows['imagelocation'];
$preferedlocation = $runrows['preferedlocation'];
$preferedcategory = $runrows['preferedcategory'];
$_SESSION['jobseekerid']= $jobseekerid;
echo "
<b>$jobseekerid
<b>$jobseekerfirstname $jobseekerlastname </b><br>
$jobseekeremail<br>
$jobseekeraddress<br>
$jobseekerphoneno<br>
<br><a href='resumeviewer.php'> Resume information</a></p>";
}
}
}
}
?>
You should pass only jobseekerid
to resumerviewer.php
echo "
<b>$jobseekerid
<b>$jobseekerfirstname $jobseekerlastname </b><br>
$jobseekeremail<br>
$jobseekeraddress<br>
$jobseekerphoneno<br>
<br><a href='resumeviewer.php?id=" . $jobseekerid . "'> Resume information</a></p>";
in resumerviewer.php
:
$run = mysql_query('SELECT * FROM `jobseekers` WHERE `jobseekerid`=' . intval($_GET['id']));
if(mysql_num_rows($run))
{
$row = mysql_fetch_assoc($run);
print_r($row);
}
精彩评论