Edit results link

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
melindaSA
Forum Commoner
Posts: 99
Joined: Thu Oct 02, 2003 7:34 am

Edit results link

Post 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!!
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post 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.

?
melindaSA
Forum Commoner
Posts: 99
Joined: Thu Oct 02, 2003 7:34 am

Post by melindaSA »

That works!!

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