gwynn_aaron wrote in php

Looking for some more help

adminSelect.php
In the head...
<?
// Create variable to load in the necessary information from the database
$query = "SELECT product_id, product_name, product_group FROM $table_2 ORDER BY product_group";
$result = @mysql_query($query, $connection) or die('Error: query could not be executed. The following error was returned: '.mysql_error());

// Create a while loop to display all of the products as options
while ($row = mysql_fetch_array($result)) {
$product_id = $row['product_id'];
$product_name = $row['product_name'];
$product_group = $row['product_group'];
$option_block .= "<option value=\"$product_id\">$product_group - $product_name</option>";
}
?>


And later on in the body...

<?
$display_block = "
<form method=\"post\" action=\"products_adminModify.php\">
<p>Choose from the list of available products.</p>
<select style=\"font: bold 11px Verdan, sans-serif; padding: 2px;\" name=\"id\">
<option>Products that can be Modified --</option>
$option_block
</select>
<input class=\"button\" type=\"submit\" name=\"submit\" value=\"Select this product\">
</form>
";
?>

<? echo "$display_block"; ?>


adminSelect.php
In the head...
<?
// Create variable to load in the necessary information from the database
$query = "
SELECT product_id, product_name, product_sku, product_upc_gtin, brand_id, product_group, product_description, product_ingredients, product_image, product_usage_tips, product_dimensions, product_weight, product_msds, product_tech_sheet, product_package_color, product_package_bw, product_line_art, product_warehousing_number, product_warehousing_dimensions, product_warehousing_weight
FROM $table_2
WHERE product_id = '" . $HTTP_POST_VARS['product_id'] . "'
";
$result = @mysql_query($query, $connection) or die('Error: query could not be executed. The following error was returned: '.mysql_error());

// Create a while loop to display all of the products as options
while ($row = mysql_fetch_array($result)) {
$product_id = $row['product_id'];
$product_name = $row['product_name'];
$product_sku = $row['product_sku'];
$product_upc = $row['product_upc_gtin'];
$brand_id = $row['brand_id'];
$product_group = $row['product_group'];
$product_description = $row['product_description'];
$product_ingredients = $row['product_ingredients'];
$product_image = $row['product_image'];
$product_usage = $row['product_usage_tips'];
$product_dimensions = $row['product_dimensions'];
$product_weight = $row['product_weight'];
$product_msds = $row['product_msds'];
$product_tech_sheet = $row['product_tech_sheet'];
$product_package_color = $row['product_package_color'];
$product_package_bw = $row['product_package_bw'];
$product_line_art = $row['product_line_art'];
$product_warehousing_number = $row['product_warehousing_number'];
$product_warehousing_dimensions = $row['product_warehousing_dimensions'];
$product_warehousing_weight = $row['product_warehousing_weight'];
}
?>


And in the body...

<tr>
<td width="30%" align="left" valign="top">Product Name</td>
<td width="70%" align="left" valign="top"><input type="text" name="product_name" value="<? echo "$product_name"; ?> size="25" maxlength="255" /></td>
</tr>


And so on, and so on.

The first two sections of code come from the document adminSelect.php which seems to be working just fine. All of the products show up in the drop-down and I can select them. The problem comes when I choose one and click on the button to modify it. This action displays adminModify.php where the other two sections of code come from. Rather than having all of the form fields correctly populated it looks like no data is being brought in from the database. I'm not sure where the problem lies, though. Do I have something wrong with adminModify.php in terms of getting information from the database or is it not getting the right product_id from adminSelect.php? Thanks for any help you can provide.