Page 1 of 1

Edit results link

Posted: Mon Jan 26, 2004 1:14 pm
by melindaSA
I am again asking for help!

I am editing a record in a mySQL database and want to show a link back to the record that has been changed. Here is my code:

edit_positions.php

Code: Select all

<?php
// include function files for this application
require_once('positions_inc_fns.php');
session_start();



do_html_header('Updating Positions');
if (check_admin_user())
{
  //if (filled_out($HTTP_POST_VARS))
 // {
    $oldposID = $HTTP_POST_VARS['oldposID'];
    $catID = $HTTP_POST_VARS['catID'];
    $depID = $HTTP_POST_VARS['depID'];
    $tID = $HTTP_POST_VARS['tID'];
    $experience = $HTTP_POST_VARS['experience'];
    $title = $HTTP_POST_VARS['title'];
    $hours = $HTTP_POST_VARS['hours'];
    $description = $HTTP_POST_VARS['description'];
    $publishdate = $HTTP_POST_VARS['publishdate'];

    if(update_positions($oldposID, $catID, $depID, $tID, $experience, $title, $hours, $description, $publishdate))
      echo 'Position <a href="show_positions.php?posID=$posID">'.$oldposID.' '.$title.' </a> was updated.<br />';
    else
      echo 'Position could not be updated.<br />';

 // }
 // else
 // echo 'You have not filled out the form.  Please try again.';

  do_html_url('admin.php', 'Back to administration menu');
}
else 
  echo 'You are not authorised to view this page.'; 

do_html_footer();

?>
The part that I cannot get to work is:

Code: Select all

<?php
echo 'Position <a href="show_positions.php?posID=$posID">'.$oldposID.' '.$title.' </a> was updated.<br />';
?>
show_positions.php

Code: Select all

<?php
include ('positions_inc_fns.php');
    session_start();
    
    $posID = $HTTP_GET_VARS['posID'];
    
  
    // get this physician from database
    $positions = get_positions_details($posID);
    do_html_header();
    display_positions_details($positions);
  
  
    // set url for "continue button"
    $target = 'positions_index.php';
    if($positions['catID'])
    {
      $target = 'show_category.php?catID='.$positions['catID'];
    }
    // if logged in as admin, show edit Positions links
    if( check_admin_user() )
    {
      display_button("edit_positions_form.php?posID=$posID", 'edit-item', 'Edit Item');
      display_button('admin.php', 'admin-menu', 'Admin Menu'); 
      display_button($target, 'continue', 'Continue');
    }
    else
      display_button('positions_category.php', 'job-index', 'Job Index');
      display_button('../HRapplication.htm', 'apply-now', 'Apply Now');
    
    do_html_footer();

?>

Thank you for you help!!

Posted: Mon Jan 26, 2004 1:19 pm
by markl999
Shouldn't :
echo 'Position <a href="show_positions.php?posID=$posID">'.$oldposID.' '.$title.' </a> was updated.<br />';

be:
echo 'Position <a href="show_positions.php?posID='.$oldposID.'">'.$oldposID.' '.$title.' </a> was updated.<br />';

or if it gets a new posID then :
echo 'Position <a href="show_positions.php?posID='.$posID.'">'.$oldposID.' '.$title.' </a> was updated.<br />';

..but i can't see where the new posID is set/comes from.

?

Posted: Mon Jan 26, 2004 1:23 pm
by melindaSA
That works!!

Thank you sooo much...what a stupid mistake :lol: