Jump to content

Drop Down Menu, Add/Remove (quantities), New/Delete Rows


pat79413

Recommended Posts

I'm new to PHP and i just started an internship that required me to post an inventory on a web page. I've been stuck on this adding a drop down menu to select between the tables and putting in four buttons (ADD/REMOVE/NEW/DELETE) for two days and my deadline is coming up fast. Here's the code. I hope y'all can help and thanks for those who do. Oh and here's the URL: http://www.brokenmug.com/test.php

 

<?

///////////////////////////////////////////////////////////////////////////////////////

/////////// Inventory of the lab parts.      ///////////////////////

///////////////////////////////////////////////////////////////////////////////////////

echo "<table border='4'>

<th>Lab Parts</th>

<tr>

</tr>";

echo "Today's date: " . date("Y.m.d") . "<br />";

 

mysql_connect("*******","****","*****");

@mysql_select_db("labparts") or die( "Unable to select database");

///////////////////////////////////////////////////////////////////////////////////////

/////////// Varibles calling the ///////////////////////

/////////// information from the ///////////////////////

/////////// database ///////////////////////

/////////// ***need a:*** ///////////////////////

/////////// Drop down menu to select      ////////////////

/////////// different tables ///////////////////////

////////// from data base.         ///////////////////////

///////////////////////////////////////////////////////////////////////////////////////

 

$assembly=mysql_query("SELECT * FROM assembly ORDER BY type");

 

$bnccables=mysql_query("SELECT * FROM bnccables ORDER BY type,length");

 

$capacitors=mysql_query("SELECT * FROM capacitors ORDER BY partno");

 

$connectors=mysql_query("SELECT * FROM connectors ORDER BY partno DESC,conversion ASC,length ASC");

 

$ic=mysql_query("SELECT * FROM ic ORDER BY description,partno");

 

$inductors=mysql_query("SELECT * FROM inductors ORDER BY partno,type");

 

$minicircuits=mysql_query("SELECT * FROM minicircuits ORDER BY type,partno");

 

$othercables=mysql_query("SELECT * FROM othercables ORDER BY type,length");

 

$resistors=mysql_query("SELECT * FROM resistors ORDER BY partno,size");

 

mysql_close();

///////////////////////////////////////////////////////////////////

/////////// List of the assembly ///////////

/////////// Creates table, calls the ///////////

/////////// assembly, and displays ///////////

/////////// them in the table. ///////////

/////////// ***need to add:*** ///////////

/////////// REMOVE, ADD, NEW, DELETE buttons ///////////

///////////////////////////////////////////////////////////////////

echo "<table border='4'>

<th>Assemb1y</th>

</tr>";

echo "<table border='4'>

<th>Quantity</th>

<th>Type</th>

<th>PartNumber</th>

<th>dB</th>

<th>Frequency</th>

<th>EndType</th>

<th>Remove</th>

<th>Add</th>

<th>New</th>

<th>Delete</th>

</tr>";

 

while($row = mysql_fetch_array($assembly))

  {

  echo "<tr>";

  echo "<td>" . $row['count'] . "</td>";

  echo "<td>" . $row['type'] . "</td>";

  echo "<td>" . $row['partno'] . "</td>";

  echo "<td>" . $row['db'] . "</td>";

  echo "<td>" . $row['frequency'] . "</td>";

  echo "<td>" . $row['endtype'] . "</td>";

  echo "</tr>";

  }

echo "</table>";

echo "<br>";

///////////////////////////////////////////////////////////////////

/////////// List of the bnccables ///////////

/////////// Creates table, calls the ///////////

/////////// bnccables, and displays ///////////

/////////// them in the table. ///////////

/////////// ***need to add:*** ///////////

/////////// REMOVE, ADD, NEW, DELETE buttons ///////////

///////////////////////////////////////////////////////////////////

echo "<table border='4'>

<th>BNC Cables</th>

</tr>";

echo "<table border='4'>

<th>Quantity</th>

<th>Type</th>

<th>Length</th>

<th>PartNumber</th>

<th>Remove</th>

<th>Add</th>

<th>New</th>

<th>Delete</th>

</tr>";

 

while($row = mysql_fetch_array($bnccables))

  {

  echo "<tr>";

  echo "<td>" . $row['count'] . "</td>";

  echo "<td>" . $row['type'] . "</td>";

  echo "<td>" . $row['length'] . "</td>";

  echo "<td>" . $row['partno'] . "</td>";

  echo "</tr>";

  }

echo "</table>";

echo "<br>";

///////////////////////////////////////////////////////////////////

/////////// List of the capacitors ///////////

/////////// Creates table, calls the ///////////

/////////// capacitors, and displays ///////////

/////////// them in the table. ///////////

/////////// ***need to add:*** ///////////

/////////// REMOVE, ADD, NEW, DELETE buttons ///////////

///////////////////////////////////////////////////////////////////

echo "<table border='4'>

<th>Capacitors</th>

</tr>";

echo "<table border='4'>

<th>Quantity</th>

<th>PartNumber</th>

<th>Type</th>

<th>C1ass</th>

<th>Value</th>

<th>Volt.Rating</th>

<th>Temp.Rating</th>

<th>Size</th>

<th>Percent</th>

<th>Remove</th>

<th>Add</th>

<th>New</th>

<th>Delete</th>

</tr>";

 

while($row = mysql_fetch_array($capacitors))

  {

  echo "<tr>";

  echo "<td>" . $row['count'] . "</td>";

  echo "<td>" . $row['partno'] . "</td>";

  echo "<td>" . $row['type'] . "</td>";

  echo "<td>" . $row['class'] . "</td>";

  echo "<td>" . $row['value'] . "</td>";

  echo "<td>" . $row['voltrating'] . "</td>";

  echo "<td>" . $row['temprating'] . "</td>";

  echo "<td>" . $row['size'] . "</td>";

  echo "<td>" . $row['percent'] . "</td>";

  echo "</tr>";

  }

echo "</table>";

echo "<br>";

///////////////////////////////////////////////////////////////////

/////////// List of the connectors ///////////

/////////// Creates table, calls the ///////////

/////////// connectors, and displays ///////////

/////////// them in the table. ///////////

/////////// ***need to add:*** ///////////

/////////// REMOVE, ADD, NEW, DELETE buttons ///////////

///////////////////////////////////////////////////////////////////

echo "<table border='4'>

<th>Connectors</th>

</tr>";

echo "<table border='4'>

<th>Quantity</th>

<th>PartNumber</th>

<th>Type</th>

<th>Frequency</th>

<th>Conversion</th>

<th>Ohms</th>

<th>Material</th>

<th>Length</th>

<th>Remove</th>

<th>Add</th>

<th>New</th>

<th>Delete</th>

</tr>";

 

while($row = mysql_fetch_array($connectors))

  {

  echo "<tr>";

  echo "<td>" . $row['count'] . "</td>";

  echo "<td>" . $row['partno'] . "</td>";

  echo "<td>" . $row['type'] . "</td>";

  echo "<td>" . $row['frequency'] . "</td>";

  echo "<td>" . $row['conversion'] . "</td>";

  echo "<td>" . $row['ohms'] . "</td>";

  echo "<td>" . $row['material'] . "</td>";

  echo "<td>" . $row['length'] . "</td>";

  echo "</tr>";

  }

echo "</table>";

echo "<br>";

///////////////////////////////////////////////////////////////////

/////////// List of the ic ///////////

/////////// Creates table, calls the ///////////

/////////// ic, and displays ///////////

/////////// them in the table. ///////////

/////////// ***need to add:*** ///////////

/////////// REMOVE, ADD, NEW, DELETE buttons ///////////

///////////////////////////////////////////////////////////////////

echo "<table border='4'>

<th>IC</th>

</tr>";

echo "<table border='4'>

<th>Quantity</th>

<th>PartNumber</th>

<th>description</th>

<th>manufacturer</th>

<th>Funct¡on</th>

<th>Frequency</th>

<th>VoltSupply</th>

<th>SensingMethod</th>

<th>AccVoltIn</th>

<th>CurrentOut</th>

<th>OperatingTemp</th>

<th>MountType</th>

<th>Package</th>

<th>Remove</th>

<th>Add</th>

<th>New</th>

<th>Delete</th>

</tr>";

 

while($row = mysql_fetch_array($ic))

  {

  echo "<tr>";

  echo "<td>" . $row['count'] . "</td>";

  echo "<td>" . $row['partno'] . "</td>";

  echo "<td>" . $row['description'] . "</td>";

  echo "<td>" . $row['manufacturer'] . "</td>";

  echo "<td>" . $row['function'] . "</td>";

  echo "<td>" . $row['frequency'] . "</td>";

  echo "<td>" . $row['voltsupply'] . "</td>";

  echo "<td>" . $row['sensingmethod'] . "</td>";

  echo "<td>" . $row['accvoltin'] . "</td>";

  echo "<td>" . $row['currentout'] . "</td>";

  echo "<td>" . $row['operatingtemp'] . "</td>";

  echo "<td>" . $row['mounttype'] . "</td>";

  echo "<td>" . $row['package'] . "</td>";

  echo "</tr>";

  }

echo "</table>";

echo "<br>";

///////////////////////////////////////////////////////////////////

/////////// List of the inductors ///////////

/////////// Creates table, calls the ///////////

/////////// inductors, and displays ///////////

/////////// them in the table. ///////////

/////////// ***need to add:*** ///////////

/////////// REMOVE, ADD, NEW, DELETE buttons ///////////

///////////////////////////////////////////////////////////////////

echo "<table border='4'>

<th>Inductors</th>

</tr>";

echo "<table border='4'>

<th>Quantity</th>

<th>PartNumber</th>

<th>Type</th>

<th>C1ass</th>

<th>Value</th>

<th>Percent</th>

<th>Size</th>

<th>Remove</th>

<th>Add</th>

<th>New</th>

<th>Delete</th>

</tr>";

 

while($row = mysql_fetch_array($inductors))

  {

  echo "<tr>";

  echo "<td>" . $row['count'] . "</td>";

  echo "<td>" . $row['partno'] . "</td>";

  echo "<td>" . $row['type'] . "</td>";

  echo "<td>" . $row['class'] . "</td>";

  echo "<td>" . $row['value'] . "</td>";

  echo "<td>" . $row['percent'] . "</td>";

  echo "<td>" . $row['size'] . "</td>";

 

  echo "</tr>";

  }

echo "</table>";

echo "<br>";

///////////////////////////////////////////////////////////////////

/////////// List of the minicircuits ///////////

/////////// Creates table, calls the ///////////

/////////// minicircuits, and displays ///////////

/////////// them in the table. ///////////

/////////// ***need to add:*** ///////////

/////////// REMOVE, ADD, NEW, DELETE buttons ///////////

///////////////////////////////////////////////////////////////////

echo "<table border='4'>

<th>Minicircuits</th>

</tr>";

echo "<table border='4'>

<th>Quantity</th>

<th>PartNumber</th>

<th>Type</th>

<th>ValueOhm</th>

<th>Frequency</th>

<th>dB</th>

<th>W</th>

<th>Remove</th>

<th>Add</th>

<th>New</th>

<th>Delete</th>

</tr>";

 

while($row = mysql_fetch_array($minicircuits))

  {

  echo "<tr>";

  echo "<td>" . $row['count'] . "</td>";

  echo "<td>" . $row['partno'] . "</td>";

  echo "<td>" . $row['type'] . "</td>";

  echo "<td>" . $row['valueohm'] . "</td>";

  echo "<td>" . $row['frequency'] . "</td>";

  echo "<td>" . $row['db'] . "</td>";

  echo "<td>" . $row['w'] . "</td>";

  echo "</tr>";

  }

echo "</table>";

echo "<br>";

///////////////////////////////////////////////////////////////////

/////////// List of the othercables ///////////

/////////// Creates table, calls the ///////////

/////////// othercables, and displays ///////////

/////////// them in the table. ///////////

/////////// ***need to add:*** ///////////

/////////// REMOVE, ADD, NEW, DELETE buttons ///////////

///////////////////////////////////////////////////////////////////

echo "<table border='4'>

<th>OtherCables</th>

</tr>";

echo "<table border='4'>

<th>Quantity</th>

<th>Type</th>

<th>Length</th>

<th>PartNumber</th>

<th>Remove</th>

<th>Add</th>

<th>New</th>

<th>Delete</th>

</tr>";

 

while($row = mysql_fetch_array($othercables))

  {

  echo "<tr>";

  echo "<td>" . $row['count'] . "</td>";

  echo "<td>" . $row['type'] . "</td>";

  echo "<td>" . $row['length'] . "</td>";

  echo "<td>" . $row['partno'] . "</td>";

  echo "</tr>";

  }

echo "</table>";

echo "<br>";

///////////////////////////////////////////////////////////////////

/////////// List of the resistors ///////////

/////////// Creates table, calls the ///////////

/////////// resistors, and displays ///////////

/////////// them in the table. ///////////

/////////// ***need to add:*** ///////////

/////////// REMOVE, ADD, NEW, DELETE buttons ///////////

///////////////////////////////////////////////////////////////////

echo "<table border='4'>

<th>Resistors</th>

</tr>";

echo "<table border='4'>

<th>Quantity</th>

<th>PartNumber</th>

<th>Type</th>

<th>C1ass</th>

<th>Value</th>

<th>Percent</th>

<th>Size</th>

<th>Remove</th>

<th>Add</th>

<th>New</th>

<th>Delete</th>

</tr>";

 

while($row = mysql_fetch_array($resistors))

  {

  echo "<tr>";

  echo "<td>" . $row['count'] . "</td>";

  echo "<td>" . $row['partno'] . "</td>";

  echo "<td>" . $row['type'] . "</td>";

  echo "<td>" . $row['class'] . "</td>";

  echo "<td>" . $row['value'] . "</td>";

  echo "<td>" . $row['percent'] . "</td>";

  echo "<td>" . $row['size'] . "</td>";

  echo "</tr>";

  }

echo "</table>";

/////////////////////////////////////////////////////////////////////////////////////////////////////////////

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.