Thanks for the script GIJew. However, I am having trouble understanding it and how it fits into my current work. I am also a newbie, so functions are a difficult concept to grasp for me (when, where, and why to use them)....so I will give you what I have and I would appreciate it if you would help me out filling in the blanks with my configuration....
Thanks.
Adrian.
Add.php
<html>
<head><title>Add Inventory</title></head>
<body>
<h2><center><font = "arial" color = "blue">Enter a New inventory</h2></center></font>
<form name=formMaker method=post action="insertinventory.php">
<table>
<tr height=30 border=1 valign=top>
<td align=right><b>Computer ID :</b></td>
<td>
<input type="text" name="idField">
</td>
</tr>
<tr height=30 valign=top>
<td align=right><b>Computer Name:</b></td>
<td>
<input type="text" name="nameField">
</td>
</tr>
<tr height=30 valign=top>
<td align=right><b>Make :</b></td>
<td>
<input type="text" name="makeField"><font size = 2> example: Dell
</td>
</tr>
<tr height=30 valign=top>
<td align=right><b>Model :</b></td>
<td>
<input type="text" name="modelField"><font size = 2> example: Dimension 5500
</td>
</tr>
<tr height=30 valign=top>
<td align=right><b>CPU :</b></td>
<td>
<select name="cpuField">
<option value="Pentium4" selected>Pentium4</option>
<option value="Pentium3">Pentium3</option>
<option value="Pentium2">Pentium2</option>
<option value="Pentium1">Pentium1</option>
<option value="Centrino">Centrino (laptop)</option>
<option value="Xeon">Xeon (server)</option>
<option value="AMD">AMD</option>
</select>
</td>
</tr>
<tr height=30 valign=top>
<td align=right><b>RAM :</b></td>
<td>
<select name="ramField">
<OPTION VALUE="1" selected>
<option value="512" >512</option>
<option value="256">256</option>
<option value="128">128</option>
<option value="64">64</option>
</select>
Other<input type="text" name="other" size="4"
maxlength="4">
</td>
</tr>
<tr height=30 valign=top>
<td align=right><b>OS :</b></td>
<td>
<select name="osField">
<option value="Windows XP" selected>Windows XP</option>
<option value="Windows 2000 Professional">Windows 2000 Professional</option>
<option value="Windows 98 SE">Windows 98 SE</option>
<option value="Windows 98">Windows 98</option>
<option value="Windows 95">Windows 95</option>
<option value="Windows 2000 Server">Windows 2000 Server</option>
<option value="Windows 2003 Server">Windows 2003 Server</option>
<option value="Mac">Mac</option>
<option value="Linux">Linux</option>
</select>
</td>
</tr>
<tr height=30 valign=top>
<td align=right><b>Formfactor :</b></td>
<td>
<input type="radio" name="formfactor" value="desktop" checked>Desktop
<input type="radio" name="formfactor" value="laptop">Laptop
</td>
</tr>
</table>
<input type=submit name=submit value="Submit">
<input type=reset name=reset value="Reset">
</form>
View.php
<?php
require_once("guestcon.inc.php");
$connect = mysql_connect($hostname,$username,$password)or die(mysql_error());
mysql_select_db($db)
OR die(mysql_error());
if ($sortby!="")
{
$sorted = " order by $sortby ";
}
$bareQuery = "select * from inventory ";
$queryall = $bareQuery.$sorted;
$resultall = MYSQL_QUERY($queryall);
$numberall = mysql_Numrows($resultall);
if ($numberall==0) {
echo "No Records Found !";
}
else if ($numberall>0) {
$x=0;
?>
<h3>List of Inventory </h3>
<table align = "center" border=1 cellspacing=0 cellpadding=10>
<tr>
<td><b><a href="<? echo $PHP_SELF; ?>?sortby=id">id</a></b></td>
<td><b><a href="<? echo $PHP_SELF; ?>?sortby=name">Name</a></b></td>
<td><b><a href="<? echo $PHP_SELF; ?>?sortby=cpu">CPU</a></b></td>
<td><b><a href="<? echo $PHP_SELF; ?>?sortby=ram">RAM</a></b></td>
<td><b><a href="<? echo $PHP_SELF; ?>?sortby=os">OS</a></b></td>
<td><b><a href="<? echo $PHP_SELF; ?>?sortby=formfactor">Form</a></b></td>
<td><b><a href="<? echo $PHP_SELF; ?>?sortby=make">Make</a></b></td>
<td><b><a href="<? echo $PHP_SELF; ?>?sortby=model">Model</a></b></td>
</tr>
<?php
while ($x<$numberall)
{
// Changing Background color for each alternate row
if (($x%2)==0) { $bgcolor="#FFFFFF"; }
else {
$bgcolor="#C0C0C0"; }
// Retreiving data and putting it in local variables for each row
$id=mysql_result($resultall,$x,"id");
$name=mysql_result($resultall,$x,"name");
$cpu=mysql_result($resultall,$x,"cpu");
$ram=mysql_result($resultall,$x,"ram");
$os=mysql_result($resultall,$x,"os");
$formfactor=mysql_result($resultall,$x,"formfactor");
$make=mysql_result($resultall,$x,"make");
$model=mysql_result($resultall,$x,"model");
?>
<tr bgcolor="<? echo $bgcolor; ?>" height=30>
<td> <? echo $id; ?> </td>
<td> <? echo $name; ?> </td>
<td> <? echo $cpu; ?> </td>
<td> <? echo $ram; ?> </td>
<td> <? echo $os; ?> </td>
<td> <? echo $formfactor; ?> </td>
<td> <? echo $make; ?> </td>
<td> <? echo $model; ?> </td>
<td><a href="edit.php?id=<? echo $CPU; ?>">Edit</a></td>
<td><a href="deleteinventory.php?id=<? echo $CPU; ?>">Delete</a></td>
<td><a href="detailsinventory.php?id=<? echo $CPU; ?>">View</a></td>
</tr>
<?php
$x++;
} // end while
?>
</table>
<?php
} // end if numberall > 0
?>
insertinventory.php
<?php
require_once("guestcon.inc.php");
$connect = mysql_connect($hostname,$username,$password)or die(mysql_error());
mysql_select_db($db)
OR die(mysql_error());
$query="insert into inventory (cpu,ram,os,id,name,formfactor,make,model,notes) VALUES
('$cpuField','$ramField','$osField','$idField','$nameField','$formfactor','$makeField',
'$modelField','$notesField')";
$result = mysql_query($query);
//if(mysql_query($connect)) die(sql_error());
//echo "success in database entry.";
?>
<H2>New Inventory Created !!</H2>
<table>
<tr height=30>
<td align=right><b>Cpu :</b></td>
<td><font color=blue><b><? echo $cpuField; ?></font></b></td>
</tr>
<tr height=30>
<td align=right><b>Ram :</b></td>
<td><font color=blue><b><? echo $ramField; ?></font></b></td>
</tr>
<tr height=30>
<td align=right><b>Os :</b></td>
<td><font color=blue><b><? echo $osField; ?></font></b></td>
</tr>
<tr height=30>
<td align=right><b>Id :</b></td>
<td><font color=blue><b><? echo $idField; ?></font></b></td>
</tr>
<tr height=30>
<td align=right><b>Name :</b></td>
<td><font color=blue><b><? echo $nameField; ?></font></b></td>
</tr>
<tr height=30>
<td align=right><b>Formfactor :</b></td>
<td><font color=blue><b><? echo $formfactor; ?></font></b></td>
</tr>
<tr height=30>
<td align=right><b>Make :</b></td>
<td><font color=blue><b><? echo $makeField; ?></font></b></td>
</tr>
<tr height=30>
<td align=right><b>Model :</b></td>
<td><font color=blue><b><? echo $modelField; ?></font></b></td>
</tr>
<tr height=30>
<td align=right><b>Notes :</b></td>
<td><font color=blue><b><? echo $notesField; ?></font></b></td>
</tr>
</table><br><br>
<a href="listoption.html">Main Menu</a><br>
<a href="view.php">View Inventory</a>