[code=php]<?php
if (!empty($_GET[‘id’])) {
$id = ($_GET[‘id’]);
if (isset($_POST[‘submit’])) {
$sql=”SELECT * from `images` WHERE `list_id` = ‘”.$id.”‘ ORDER BY `sub_cat` ASC “;
$result = @mysql_query($sql);
if ($result) {
while ($row = mysql_fetch_assoc($result)) {
$pic_id = $row[‘img_id’];
$desc = $_POST[”.$pic_id.’pic_desc’];
$default = $_POST[‘default[‘.pic_id.’]’];
if ($default == 1){
$sub_cat = $default;
}
if (sub_cat1 > 1){
$sub_cat = $sub_cat1
}
$pic_cat=”UPDATE `images` SET `sub_cat`='”.$sub_cat.”‘, `desc` ='”.$desc.”‘ WHERE `img_id`='”.$pic_id.”‘ “;
$pic_result= @mysql_query($pic_cat);
}
?>
later in the script i have a form that has imges pulled along with their categories….default, inside, outside, blue print
[code=php]<?php
$sql=”SELECT * from `images` WHERE `list_id` = ‘”.$id.”‘ ORDER BY `sub_cat` ASC LIMIT 0, 30″;
$result = @mysql_query($sql);
if ($result) {
while ($row = mysql_fetch_assoc($result)) {
$pic_id = $row[‘img_id’];
if ($row[‘sub_cat’] == ‘1’) { $def_status = ‘checked=”checked”‘; }
elseif ($row[‘sub_cat’] == ‘2’) { $ins_status = ‘checked=”checked”‘; }
elseif ($row[‘sub_cat’] == ‘3’) { $out_status = ‘checked=”checked”‘;}
elseif ($row[‘sub_cat’] == ‘4’) { $blue_status = ‘checked=”checked”‘;
}?>
<table width=”100%” border=”0″>
<tr>
<td width=”47%” valign=”top” class=”form_text”><img src=”../../images/house/<?php echo “”.$id.”/”.$row[‘image’].”” ?>” width=”175″ ></td>
<td width=”23%” valign=”top” nowrap=”nowrap” class=”form_text”>
<input type=”radio” name=”<?php echo ‘default[‘.pic_id.’]’;?>” onclick=”setDisplay(‘<?php echo $pic_id.’setA’;?>’)” value=”1″ <?PHP print $def_status; ?> />Default<br />
<div id=”<?php echo $pic_id.’setA’; ?>” class=”setDiv”>
<input type=”radio” name=”<?php echo ‘set1[‘.$pic_id.’]’; ?>” value=”2″ <?PHP print $ins_status; ?>/>Inside<br />
<input type=”radio” name=”<?php echo ‘set1[‘.$pic_id.’]’ ?>” value=”3″ <?PHP print $out_status; ?>/>Outside<br />
<input type=”radio” name=”<?php echo ‘set1[‘.$pic_id.’]’ ?>” value=”4″ <?PHP print $blue_status; ?>/>Blue Print<br />
</div>
</td>
<td width=”30%” align=”left” valign=”top” class=”form_text”>
<textarea name=”<?php echo $pic_id.’pic_desc’;?>” cols=”30″ rows=”5″></textarea>
</td>
</tr>
<tr>
<td colspan=”3″ valign=”top” ><hr /></td>
</tr>
</table>
The only thing that passes correctly is the desc short description of the pictures….