将唯一的会话变量传递给resumerviewer.php页面

时间:2011-02-24 02:27:50

标签: php variables echo

<?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 out 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>";
            }
        }
    }
}
?>

1 个答案:

答案 0 :(得分:0)

您应该只将jobseekerid传递给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>";
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);
}