remove the hidden field and use
<input type='text' size='2' name='catorder[{$array["catid"]}]' value='{$array["catorder"]}'>
in action script you do
foreach($_POST['catorder'] as $catid => $catorder) {
update categories set catorder=$catorder where catid=$catid
}
Steve Jackson wrote:
I am trying to set the order of a set of categories. Previously the
catid field sorted the order of the categories. However I changed this
to Order By catorder and then set about writing a simple update query to
allow people to set the order.
I can't see anything wrong with this:
Basically I pull the details from the categories DB into an array and
then display in a table. This works fine
<?
while ($array = mysql_fetch_array($mysql))
{
echo "<tr><td width='150'><span class='adminisoleipa'>";
echo "<input type='hidden' name='categoryid'
value='{$array["catid"]}'>";
echo "{$array["catname"]}";
echo "</td><td><input type='text' size='2' name='catorder'
value='{$array["catorder"]}'>";
echo "</span></td></tr>";
}
?>
Then using this to update it seems to work till you check the update. It
sets the first two fields to one for some reason.
$query = "update categories
set catorder = '$catorder'
where catid='$categoryid'";
Any suggestions?
Steve Jackson
Web Developer
Viola Systems Ltd.
http://www.violasystems.com
[EMAIL PROTECTED]
Mobile +358 50 343 5159
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php