Forum Moderators: coopster
<?phpinclude_once("db.php");
//load data
//declare the SQL statement that will query the database
$query = "SELECT [Cost Centre],
[Company Code],
[Company Description],
[Profit Centre Description],
[Profit Centre Manager],
PCMEmailAddress,
DFD,
DFDEmailAddress,
[Business Unit],
[Symonds Div Level],
[Symonds Div Level Description],
[Symonds Bus Unit Level],
[Symonds Regional Level],
DivisionID
FROM Structure ORDER BY [Cost Centre]";
//execute the SQL query and return records
$result = mssql_query($query);
$numRows = mssql_num_rows($result);
//echo $numRows ;
?>
<style type="text/css">
body {background-color: #ffffff; color: #000000;}
body, td, th, h1, h2 {font-family: sans-serif;}
textarea {font-family: sans-serif; overflow: hidden;}
input {width:50px;}
pre {margin: 0px; font-family: monospace;}
a:link {color: #000099; text-decoration: none; background-color: #ffffff;}
a:hover {text-decoration: underline;}
table {border-collapse: collapse;}
.center {text-align: center;}
.center table { margin-left: auto; margin-right: auto; text-align: left;}
.center th { text-align: center!important; }
td, th { border: 1px solid #000000; font-size: 75%; vertical-align: baseline;}
h1 {font-size: 150%;}
h2 {font-size: 125%;}
.p {text-align: left;}
.e {background-color: #ccccff; font-weight: bold; color: #000000;}
.h {background-color: #9999cc; font-weight: bold; color: #000000;}
.v {background-color: #cccccc; color: #000000;}
.vr {background-color: #cccccc; text-align: right; color: #000000;}
img {float: right; border: 0px;}
hr {width: 600px; background-color: #cccccc; border: 0px; height: 1px; color: #000000;}
</style>
<center>
<table cellpadding='5' align='center'>
<tr>
<td style='padding: 0em 0em 0em 0em;' colspan='15'><img src='http://www.capitasymonds.co.uk/images/logo.gif'>
<img src='http://www.capitasymonds.co.uk/images/Careers_home.jpg'></td>
</tr>
<tr bgcolor="#AAAAFF">
<th>Cost Centre</th>
<th>Company Code</th>
<th>Company Description</th>
<th>Profit Centre Description</th>
<th>Profit Centre Manager</th>
<th>Email Address</th>
<th>Divisional Finance Director</th>
<th>Email Address</th>
<th>Symonds Div Level</th>
<th>Symonds Div Level Description</th>
<th>Symonds Bus Unit Level</th>
<th>Symonds Regional Level</th>
<th>Void</th>
<th>Edit</th>
</tr>
<?
//display the results
while($row = mssql_fetch_array($result))
{
if ($row["Cost Centre"] == $_GET[costcentreedit])
{
//output the edit code
?>
<tr bgcolor="#FFFFCC" >
<td id='<?echo $row["Cost Centre"];?>'><?echo $row["Cost Centre"];?></td>
<td><?echo $row["Company Code"];?></td>
<td><?echo $row["Company Description"];?></td>
<td><?echo $row["Profit Centre Description"];?></td>
<td><textarea style='font-size:85%;' rows='1'><?echo $row["Profit Centre Manager"];?></textarea></td>
<td><textarea style='font-size:85%;' rows='1' cols='40'><?echo $row["PCMEmailAddress"];?></textarea></td>
<td><textarea style='font-size:85%;' rows='1'><?echo $row["DFD"];?></textarea></td>
<td><textarea style='font-size:85%;' rows='1' cols='40'><?echo $row["DFDEmailAddress"];?></textarea></td>
<td><textarea style='font-size:85%;' rows='1' cols='15'><?echo $row["Symonds Div Level"];?></textarea></td>
<td><select style='font-size:85%;' >
<option selected value ="Central Services">Central Services</option>
<option value ="Infrastructure">Infrastructure</option>
<option value ="Management">Management</option>
<option value ="Regions">Regions</option>
</select></td>
<td><textarea style='font-size:85%;' rows='1' cols='15'><?echo $row["Symonds Bus Unit Level"];?></textarea></td>
<td><textarea style='font-size:85%;' rows='1' cols='15'><?echo $row["Symonds Regional Level"];?></textarea></td>
<td><form action="index.php?" method="get"><input type="hidden" name="costcentrevoid" value="<?echo $counter;?>"><input type='submit' value='Void'></form></td>
<td><form action="index.php?" method="get"><input type="hidden" name="costcentresave" value="<?echo $counter;?>"><input type='submit' value='Save'></form></td>
</tr>
<?
}
else
//just output the data
{
?>
<tr>
<td id='<?echo $row["Cost Centre"];?>'><?echo $row["Cost Centre"];?></td>
<td><?echo $row["Company Code"];?></td>
<td><?echo $row["Company Description"];?></td>
<td><?echo $row["Profit Centre Description"];?></td>
<td><?echo $row["Profit Centre Manager"];?></td>
<td><?echo $row["PCMEmailAddress"];?></td>
<td><?echo $row["DFD"];?></td>
<td><?echo $row["DFDEmailAddress"];?></td>
<td><?echo $row["Symonds Div Level"];?></td>
<td><?echo $row["Symonds Div Level Description"];?></td>
<td><?echo $row["Symonds Bus Unit Level"];?></td>
<td><?echo $row["Symonds Regional Level"];?></td>
<td><form action="index.php?" method="get"><input type="hidden" name="costcentrevoid" value="<?echo $counter;?>"><input type='submit' value='Void'></form></td>
<td><form action="index.php?" method="get"><input type="hidden" name="costcentreedit" value="<?echo $counter;?>"><input type='submit' value='Edit'></form></td>
</tr>
<?
}
}
//close the connection
mssql_close($dbhandle);
?>
</center>