I have a program that I need to get data from every record in a certain table and print it out in input fields of forms I got that much done... now I am to the updating part which seemed like it would be easy just by storing hte updated information to an array and then sending it off to another script which would update the database with the new information but I can't figure out how to pass the information on to the other script I use this: <input type=select name=\"" . $key[$itemrow[0]][0] . "\" value=\"$itemrow[1]\"> except when I try to view source it shows name as name="". So i'm not sure if it is really working or what any help would be great below is the source code
Thanks in Advance,
Armando
<?php
mysql_connect (localhost, username, pass);
mysql_select_db (database);
if (isset($key[0][0])){
//$key = unserialize(urldecode($key));
$i=1;
while (isset($key[$i][0]) && isset($key[$i][1]) && isset($key[$i][2])) {
echo $key[$i][1];
$i++;
}
exit;
}
//Above is testing printing of the array It doesn't seem to be able to get this far though
if (isset($cat)) {
print "<h2>Update items for $cat.</h2>";
$itemquery = "select item_id, item, cost, vendor from inventory where cat = '$cat'";
$itemresult = mysql_query ($itemquery)
or die ("Query Failed");
print "
<form method=post action=updateprices.php>
<table width=75%>
<tr><th>Item</th><th>Cost</th><th>Vendor</th></tr>";
$key = array();
while ($itemrow = mysql_fetch_array ($itemresult)) {
//print "<tr><td><input type=select name=\"{$key[$itemrow[0]][0]}\" value=\"$itemrow[1]\"></td><td><input type=select name=\"{$key[$itemrow[0]][1]}\" value=\"$itemrow[2]\"></td><td><input type=select name=\"{$key[$itemrow[0]][2]}\" value=\"$itemrow[3]\"></td></tr>";
print "<tr><td><input type=select name=\"" . $key[$itemrow[0]][0] . "\" value=\"$itemrow[1]\"></td><td><input type=select name=\"" . $key[$itemrow[0]][1] . "\" value=\"$itemrow[2]\"></td><td><input type=select name=\"" . $key[$itemrow[0]][2] . "\" value=\"$itemrow[3]\"></td></tr>";
}
//$key=serialize($key);
//$key=urlencode($key);
print "</table><input type=submit value=Next></form>";
} else {
$catquery = "select cat, name from cat ORDER BY cat";
$catresult = mysql_query ($catquery)
or die ("Query Failed");
$i=0;
print "
<form method=post action=updateprices.php>Enter Category to Update<br><input type=text name=cat size=2 maxlength=2><table><tr><td>";
while ($catrow = mysql_fetch_array ($catresult)) {
if ($i=="10") {
print "</td><td>$catrow[0] - $catrow[1]<br>";
$i++;
} elseif ($i=="20") {
print "</td><td>$catrow[0] - $catrow[1]<br>";
$i++;
} elseif ($i=="30") {
print "</td><td>$catrow[0] - $catrow[1]<br>";
$i++;
} elseif ($i=="40") {
print "</td><td>$catrow[0] - $catrow[1]<br>";
$i++;
} else {
print "$catrow[0] - $catrow[1]<br>";
$i++;
}
}
print "</form></td></tr></table>";
}