使用带有下拉选项的php更新mysql数据

I am trying to update my products table using a product form but it is throwing an error for an undefined variable here is my code for the productform.php

<?php
$ProductID= $_GET['ProductID'];
//Connect and select a database
mysql_connect ("localhost", "root", "");
mysql_select_db("supplierdetails");
{
$result = mysql_query("SELECT * FROM products WHERE ProductID=$ProductID");
while($row = mysql_fetch_array($result))
  {
 $ProductID= $_GET['ProductID'];
 $ProdDesc = $row['ProdDesc'];       
 $SupplierID = $row['SupplierID'];   
 $Location = $row['Location'];
 $Cost = $row['Cost'];
 $Status = $row['Status'];
 $MRL = $row['MRL'];        
 $ProductID = $row['ProductID'];   
}     
?>     
//form 
<form action="Edit_Prod.php" method="post">

<input type="hidden" name="ProductID" value="<?php echo $ProductID; ?>"/> 

<label>Product Description:
 <span class="small">Please enter a description for the product </span>
 </label>
 <input type="text" name="ProdDesc" value="<?php echo $ProdDesc ;?>" />
<label>Supplier ID
 <span class="small">Please enter the Supplier ID</span>
 </label>
  <input type="text" name="SupplierID" value="<?php echo $SupplierID ;?>" />
   <label>Bay Location:
 <span class="small">Please select the bay location for this product </span>
 </label>
  <select name="Location" value="<?php echo $Location ;?>" />
 <option>A1</option>
 <option>A2</option>
 <option>A3</option>
 <option>A4</option>
 <option>A5</option>
 <option>B1</option>
 <option>B2</option>
 <option>B3</option>
 <option>B4</option>
 <option>B5</option>
 <option>C1</option>
 <option>C2</option>
 <option>C3</option>
 <option>C4</option>
 <option>C5</option>
 <option>D1</option>
 <option>D2</option>
 <option>D3</option>
 <option>D4</option>
 <option>D5</option>
 <option>E1</option>
 <option>E2</option>
 <option>E3</option>
 <option>E4</option>
 <option>E5</option>
</select>

<label>Product Cost:
 <span class="small">Please enter a  new cost for the product (per roll) </span>
 </label>
  <input type="text" name="Cost" value="<?php echo $Cost ;?>" />

<label>Status:
 <span class="small">Please select a status for the product </span>
 </label>
  <select name="Status" value="<?php echo $Status ;?>" />
 <option>Live</option>
 <option>Mature</option>
 <option>Obsolete</option>
 </select>
 <label>MRL
 <span class="small">Please enter a minimum re-order level for this product </span>
 </label>
 <input type="text" name="MRL" value="<?php echo $MRL ;?>" />
 <input type="submit" value= "Edit Product Details"/>

Undefined variable all lines, do i have to do anything differently if using drop down areas*

*Edit_Prod.php*

<?php
     $con = mysql_connect("localhost", "root", "");  
        mysql_select_db("supplierdetails");   
          if (!$con)     
             {       
        die('Could not connect: ' . mysql_error());        
         }    
      //Run a query        
          $ProductID = $_POST['ProductID'];
      $result = mysql_query ("SELECT * FROM products WHERE Productid= '".$Productid."'") or die(mysql_error());     
      $row = mysql_fetch_array($result); 
      $ProdDesc = $_POST['ProdDesc'];       
      $SupplierID = $_POST['SupplierID'];   
      $Location = $_POST['Location'];
      $Cost = $_POST['Cost'];
      $Status = $_POST['Status'];
      $MRL = $_POST['MRL'];        
      $Productid=$row['Productid'];   
      $query="UPDATE products SET ProdDesc='".$ProdDesc."', SupplierID='".$SupplierID."', Location='".$Location."', Cost='".$Cost."', Status='".$Status."', MRL='".$MRL."' WHERE   ProductID='".$ProductID."'";
      $result = mysql_query($query);  
//Check whether the query was successful or not    
 if($result) 
{          
     echo "Products Updated";
     header ("Location: Products.php");    
 }
else 
{        
     die ("Query failed");    
      }    
 ?>

i think $row vairable is used to get values from database which you have missed

$productID= $_GET['productid'];
$records =mysql_query(" select * from tableName where productid=$productID");

$row=mysql_fetch_array($records);

then your code will work

$supplId= $row['supplId'];
...

Answering to your question "do i have to do anything differently if using drop down areas", of course you have to change it. Change:

<select name="Location" value="<?php echo $Location ;?>" />
 <option>A1</option>
 <option>A2</option>
 <option>A3</option>
 <option>A4</option>
 <option>A5</option>
.
.

. . .. . To:

<select name="Location"  />
 <option value="<?=$Location;?>" selected="selected" ></option>
 <option>A1</option>
 <option>A2</option>
 <option>A3</option>
 <option>A4</option>
 <option>A5</option>

like that. I think you got the idea. You have to get value as an option under select. Try it. Good luck.