Hi I want to select product data out of my table in textboxes. I then want to edit these text boxes and update them via a submit button.

Iíve got the select bit right but not the update bit right i think. Plus its not going through my IF staments at the start.

I have also tested the script with the var_dump(); function I have two on this code. The first one gives me no server message but the second gives me "bool(false)" this is not correct as it should retun true.

PHP Code:
<?php //editthat.php
            ######################################################
            #    Name: PhoenixGems.co.uk :. CMS                   #
            #     Author: Peter Fisher                             #
            #    Contact Details: [email]153570@wiltscoll.ac.uk[/email]          #
            #                     [email]pfwdenquiry@aol.com[/email]             #
            #                     [url]www.Studentgather.com/pfwd[/url]      #
            #     Purpose: Content Management System               #
            #            for [url]www.phoenixGems.co.uk[/url]               #
            #   Program Name: Edit Selected query                #        
            #   Program purpose: To Select data                  #
            #                    from editproducts.php from      #
            #                    given post variables.  this     #
            #                    data will the be displayed      #
            #                    via text boxes. The user can    #
            #                    then edit data and update the   #
            #                    products table.                 #
            ######################################################
?>
<?php
include('header.php'); //Include the header file
?>
<?php 
require_once ('mysql_connect.php'); //connect to the database
// print the sent array ===> below can be commented out. this is only used for testing
//if ($_SERVER['REQUEST_METHOD'] == 'POST') { 
//exit(print_r($_POST)); 
//} 
// The sent array can be deleted ======>Above can be commented out. this is only used for testing


// =========================================================================
//                        Handle the form 
//==========================================================================
// run the following program if the form has been submitted 
if (isset($_POST['submit'])) {
    
//Create an empty variable for the out response message
    
$message NULL
    
        
//If magic quotes are on then strip down the slashes
        
if (get_magic_quotes_gpc()){ 
            
$_POST['productID'] = stripslashes($_POST['productID']); 
            
$_POST['image_name'] = stripslashes($_POST['image_name']); 
            
$_POST['colour'] = stripslashes($_POST['size']); 
            
$_POST['price'] = stripslashes($_POST['price']); 
            
$_POST['name'] = stripslashes($_POST['name']);     
        } 
    
//Escape all data and trim
    
$productID mysql_real_escape_string(trim($_POST['productID'])); 
    
$image_name mysql_real_escape_string(trim($_POST['image_name'])); 
    
$size mysql_real_escape_string(trim($_POST['size'])); 
    
$colour mysql_real_escape_string(trim($_POST['colour'])); 
    
$price mysql_real_escape_string(trim($_POST['price'])); 
    
$name mysql_real_escape_string(trim($_POST['name'])); 
    
//Update the  product table with posted variables
     
$query ="UPDATE product SET  name= '$name', image_name = '$image_name' ,size ='$size', colour ='$colour', price ='$price' WHERE productID = '$productID'"
     
$result mysql_query($query);
     
mysql_query($query) or die(mysql_error());
     
         
# === > Error it is not picking up this var_dump and no messages are coming from the server
         
var_dump(mysql_affected_rows() == 1); 
         if (
mysql_affected_rows() == 1) { 
             
$message =  print"<table align=\"center\" width=\"505\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" class=\"backgroundbox\"> 
                                  <tr> 
                                    <td colspan=\"3\" class=\"infofield\"><font color=\"#FF0000\"> 
                                        : SYSTEM RESPONSE :  All CHOSSEN DATA HAS BEEN EDITED : 
                                       </td> 
                                </tr> var_dump(
$message)"
                         exit();
//Exit the program and carry on with the page                             
           // If data failed to edit send a negative response with a back button
           
} else { 
                       
$message = print"<table align=\"center\" width=\"505\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" class=\"backgroundbox\"> 
                                         <tr> 
                                            <td colspan=\"3\" class=\"infofield\"> 
                                                : SYSTEM RESPONSE :  SYSTEM DOWN PELEASE TRY AGAIN: NO DATA EDITED :</td> 
                                          </tr> 
                                            <td class=\"bodytxt\"valign=\"top\" height=\"68\">         
                                             Please <a href=\"javascript:window.history.back()\">click here</a> to be sent back to the last page you wher found on. 
                                            </td>"
;              
                 } 
                
mysql_close();//Close connection 
            

    
# ========> Error It has picked up this var_dump and the server message is "BOOL(false) which is wrong as $messages should be TRUE        
    
var_dump(isset($message));
    if (isset(
$message)){//Print the message if there is one 
    
echo "<table align=\"center\" class=\"backgroundbox\" width=\"397\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\"> 
            <tr> 
                  <td class=\"infofield\" height=\"19\" valign=\"top\" width=\"397\">: QUERY REPORT :</td> 
            </tr> 
            <tr> 
               <td class=\"bodytxt\"valign=\"top\" height=\"68\"> 
                 <hr> 
                    Please read the following statement(s). 
                 <hr> <p>     
                        ', 
$message,' 
               </td> 
            </tr> 
         </table>"

    include (
'footer.php');//Include the footer 
    
exit(); //Exit the program and carry on with the page 
   
}    
?> 
<!--
  ==========================================================================
                        Display the form and table 
 ==========================================================================
-->
<form action="<?php echo $PHP_SELF?>" method="post"> 
  <table align="center" cellpadding="5" cellspacing="0" border="1">  
<?php //Display the top fields of table
echo "<tr>
          <td class=\"infofield\">ID</td>
          <td class=\"infofield\"> Name</td>
        <td class=\"infofield\">Type</td>
         <td class=\"infofield\">Category</td>
          <td class=\"infofield\">Image Name</td>
           <td class=\"infofield\">Size</td>
        <td class=\"infofield\">Colour</td>
           <td class=\"infofield\">Price</td>
    </tr>"
;
?>
<?php 
    
//If magic quotes are on then strip down the slashes          
    
if (get_magic_quotes_gpc()){ 
        
$_GET['product'] = stripslashes($_GET['product']); 
        
$_GET['type'] = stripslashes($_GET['type']); 
        
$_GET['category'] = stripslashes($_GET['category']); 
    } 
//Escape all the srtings   
$product mysql_real_escape_string($_GET['product']); 
$type mysql_real_escape_string($_GET['type']); 
$category mysql_real_escape_string($_GET['category']); 

//Select row of chosen product
$query "SELECT * FROM product, product_category, product_type  WHERE product.productID = '$product' AND product_type.typeID = '$type' AND product_category.category_id = '$category'"
mysql_query($query) or die(mysql_error());
$results mysql_query ($query); 
$row mysql_fetch_array ($resultsMYSQL_ASSOC);  
// Display the selected product in textboxes ready to be edited. 
echo"<tr> 
        <td class=\"bodytxt\"></td>"

  echo 
"<td class=\"bodytxt\" ><input type=\"textbox\" name=\"name\" "
  echo 
"value=\""."$row[name]"."\" /></td>"
  echo 
"<td class=\"bodytxt\" >{$row['type']}</td>";
  echo 
"<td class=\"bodytxt\" >{$row['category']}</td>"
  echo 
"<td class=\"bodytxt\" ><input type=\"textbox\" name=\"image_name\" "
  echo 
"value=\""."$row[image_name]"."\" /></td>"
  echo 
"<td class=\"bodytxt\" ><input type=\"textbox\" name=\"size\" "
  echo 
"value=\""."$row[size]"."\" /></td>"
  echo 
"<td class=\"bodytxt\" ><input type=\"textbox\" name=\"colour\" "
  echo 
"value=\""."$row[colour]"."\" /></td>"
  echo 
"<td class=\"bodytxt\" ><input type=\"textbox\" name=\"price\" "
  echo 
"value=\""."$row[price]"."\" /></td>"
  echo 
"<td class=\"bodytxt\"></td>"
  echo 
"<td align=\"right\"><input type=\"hidden\" name=\"productID\" value=\"$row[productID]\"></td> "
echo
"</tr>";          
?> 
 </table> 
 <div align="center"><input type="submit" value="Edit Selected" /> </div>
</form> 
<!--
  ==========================================================================
                        End displaying the form and table 
 ==========================================================================
-->
<?php
include('footer.php');//Include footer file
                      //End editthat.php
?>
I havenít got a clue whats wrong with this it just wont update
Please help