HI Sidney
thanks for your help its been amazing
I have got it all working it goes into 3 pages which im not bothered about it runs pefectly and i got the error messages working,
I could not tell you how i got it working , kinda out of the blue
maybe the fella upstairs had did his magic but if wanna look at the code here it is...
the first page request.php
<?php
session_start();
header("Cache-control: private");
doCSS();
print("<CENTER><h1>Welcome to the admin page <b>".$_SESSION["login"]."</h1></b></CENTER><br>\n");
include_once("start_page_admin.php");
print subtitle("<center><H1>View Staff</H1></center>");
include_once("start_page_test.php");
?>
<form method="POST" action="quest.php">
<CENTER>Enter Staff ID Number:<input type="text" name="staff"> <input type="submit"> </CENTER>
</form>
now on to the page quest.php
<?php
session_start();
header("Cache-control: private");
global $link;
doCSS();
print start_form("viewstaff2.php");// this function make sure that when the submit button is pressed it goes to the page "viewstaff2.php"
echo $staff;
if(isset($_POST['staff']))
{
field_validator("staff", $_POST["staff"], "number", 1,7);
if( !($row = check_id($_POST['staff'])) )
{
// Staff ID does not exist, create an error message:
$messages[]=" Staff ID does not exist please, try again";
}
}
if(empty($messages))
{
print("<BR><BR><BR><BR><BR><BR>");
// begin the survey form.
print start_form();
// get the current survey questions from the database and display
// them to the user for voting.
print subtitle("<CENTER>Start the ***:</CENTER>");
# field_validator($field_descr, $field_data, $field_type, $min_length="", $max_length="", $field_required=1) {
//print "staff details modified to system";
$query3 = "select * from staff where staff_id='$staff'";
$result = mysql_query($query);
//will work. then to put all the results in textboxes
// Run query:
$result=mysql_query($query3, $link) or die("MySQL query $query failed. Error if anyzzzz: ".mysql_error());
$data = mysql_fetch_array($result);
print "<center>";
print"<H3>Edit details of staff memeber <H3>";
print"<table>";?>
<form action="<?=$_SERVER["PHP_SELF"]?>" method="POST"><?
print"<TABLE>";
print "<input type=\"text\" name=\"staff_id\" value=\"{$data[0]}\"><br />\n";
echo "</tr>";
echo "<input type=\"text\" name=\"first_name\" value=\"{$data[1]}\"><br />\n";
echo "<input type=\"text\" name=\"last_name\" value=\"{$data[2]}\"><br />\n";
echo "<input type=\"text\" name=\"faulty_id\" value=\"{$data[3]}\"><br />\n";
echo "<input type=\"text\" name=\"date_started\" value=\"{$data[4]}\"><br />\n";
echo"<input type=\"text\" name=\"group_id\" value=\"{$data[5]}\"><br />\n";
?>
<form method="POST" action="viewstaff2.php">
<INPUT TYPE="submit">
<INPUT name="update" TYPE="hidden" value="value">
</TABLE>
</center>
</form>
<? }
else
{
displayErrors($messages);
echo"<CENTER>click back to try again update errpr </CENTER>";
}
The last file [staffview2.php]
<?php
session_start();
header("Cache-control: private");
include_once("start_page_test.php");
include_once("config.php");
include_once("forms.php");
global $link;
doCSS();
print("<BR><BR><BR><BR><BR><BR>");
echo $staff;
print"<BR>";
echo"this is the query";
print"<BR>";
$query="UPDATE staff SET first_name='$first_name', last_name='$last_name', faulty_id='$faulty_id', date_started='$date_started', group_id='$group_id' WHERE staff_id='$staff_id'";
echo $query;
print"<BR>";
if(!isset($_POST['submit']))
{
$query="UPDATE staff SET first_name='$first_name', last_name='$last_name', faulty_id='$faulty_id', date_started='$date_started', group_id='$group_id' WHERE staff_id='$staff_id'";
//$result = mysql_query($query);
//will work. then to put all the results in textboxes
// Run query:
$result=mysql_query($query, $link) or die("MySQL query $query failed. Error if any: ".mysql_error());
print"Saved";
}
else
{
displayErrors($messages);
echo"<CENTER>click back to try again update errpr </CENTER>";
}
?>
Thanks for your help sidney, seriously dude I might even get a proper degree!!!
what will the neighbours say for this..........