SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Member monkeynme's Avatar
    Join Date
    Oct 2003
    Location
    Colorado Springs
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    need dynamic link to connect to detail page

    I have a "master" page which lists all of the jobs available. I want a user to be able to click on the job title and it will jump to a "detail" page which will give the rest of the job details and a link to submit a resume.

    I have the "master" and "detail" pages created. But how do I set the link in the job title variable to call the detail page with the correct information?

    The "master" setup PHP code looks like this:

    PHP Code:
    <?php require_once('Connections/EagleMain.php'); ?>
    <?php
    mysql_select_db
    ($database_EagleMain$EagleMain);
    $query_Jobs "SELECT jobID, jobTitle, jobPostdate, jobStatus FROM jobs ORDER BY jobPostdate ASC";
    $Jobs mysql_query($query_Jobs$EagleMain) or die(mysql_error());
    $row_Jobs mysql_fetch_assoc($Jobs);
    $totalRows_Jobs mysql_num_rows($Jobs);
    ?>
    The "master" dynamic table looks like this:

    Code:
    <td><?php echo $row_Jobs['jobID']; ?>
                    </td>
                    <td><?php echo $row_Jobs['jobTitle']; ?>
                    </td> 
                    <td><?php echo $row_Jobs['jobPostdate']; ?>
                    </td>
                    <td><?php echo $row_Jobs['jobStatus']; ?>
                    </td>
    I assume an "A HREF" variable needs to be set with the jobTitle variable, and something needs to be added to the detail page that responds to the "call". But I can't find code for this anywhere. I only see FORM session variable assignments.

  2. #2
    Knowledge is key 2 progression Tryst's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not sure if i'm right here, but you can linkto the details page and also send a variable as part of the URL (ie details.php?jobid=123). Then on the details.php page you can run a query with jobid value (which is extracted via $_GET) contained with in it (ie SELECT *------------- WHERE jobid = '.$jobid)

    I'm not sure if this is the best way, but its an alternative :-)

    Tryst

  3. #3
    SitePoint Member monkeynme's Avatar
    Join Date
    Oct 2003
    Location
    Colorado Springs
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, it looks like I found a solution...with one problem. The jobTitle link looks like this:

    <a href="jobdetail.php?id=$row_Jobs['jobID']"><?php echo $row_Jobs['jobTitle']; ?></a>

    When I set up the detail page, I included a GET statement:

    PHP Code:
    <?php require_once('Connections/EagleMain.php'); ?>
    <?php
    mysql_select_db
    ($database_EagleMain$EagleMain);
    $query_Jobs "SELECT * FROM jobs";
    $Jobs mysql_query($query_Jobs$EagleMain) or die(mysql_error());
    $row_Jobs mysql_fetch_assoc($Jobs);
    $totalRows_Jobs mysql_num_rows($Jobs);
    $row_Jobs['jobID'] = $_GET['id'];
    ?>
    All the dynamic text shows up, except the text for JOB ID says

    $row_Jobs[\'jobID\']

    instead of the actual job number. Where did I go wrong? Here is the DETAIL page dynamic table setup:

    <tr><td>Job ID: <?php echo $row_Jobs['jobID']; ?></td>
    </tr>
    <tr>
    <td>Job
    Title: <?php echo $row_Jobs['jobTitle']; ?></td>
    </tr>
    <tr>
    <td>Status: <?php echo $row_Jobs['jobStatus']; ?></td>
    </tr>
    <tr>
    <td>Date: <?php echo $row_Jobs['jobPostdate']; ?></td>
    </tr>
    <tr>
    <td>Responsibilities: <?php echo $row_Jobs['jobRespons']; ?></td>
    </tr>
    <tr>
    <td>Qualifications: <?php echo $row_Jobs['jobQualif']; ?></td>
    </tr>
    <tr>
    <td>Company/Product: <?php echo $row_Jobs['jobCompany']; ?>td>

  4. #4
    Knowledge is key 2 progression Tryst's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try assigning the $_GET variable to a variable first (ie $test = $_GET) then echo it to see if the jodid value is being passed between the pages. If it is then set $row_jobs['jodid'] = $test

    Tryst

  5. #5
    Knowledge is key 2 progression Tryst's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry, that should be

    $test = $_GET['id'];

    Tryst

  6. #6
    SitePoint Member monkeynme's Avatar
    Join Date
    Oct 2003
    Location
    Colorado Springs
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not sure if I'm understanding this, but I adjusted the code like this:

    PHP Code:
    mysql_select_db($database_EagleMain$EagleMain);
    $query_Jobs "SELECT * FROM jobs";
    $Jobs mysql_query($query_Jobs$EagleMain) or die(mysql_error());
    $row_Jobs mysql_fetch_assoc($Jobs);
    $totalRows_Jobs mysql_num_rows($Jobs);
    $test $_GET['id'];
    $row_Jobs['jobID'] = $test
    with the table variable still being:

    <?php echo $row_Jobs['jobID']; ?>

    but when going LIVE the JobID field shows nothing now.

  7. #7
    Knowledge is key 2 progression Tryst's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you sure a variable is being past between the pages?? Try

    echo $test;

    to see if a variable is printed.

    Tryst

  8. #8
    SitePoint Member monkeynme's Avatar
    Join Date
    Oct 2003
    Location
    Colorado Springs
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no, the test shows the variable is not being passed. And I also know this because when I look at the detail pages for ALL of the jobs entries, the data is the same as the first entry.

    I guess the MASTER page (see above) is missing something. So do I need to just start this whole process over using some new code from somewhere? It can't be this hard. There's got to be just a small thing I'm missing.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •