im having a problem now.. i fixed the javascript i think..
if($mode == "caption") {
$query = mysql_query("SELECT image_caption from image where image_member_id = '$session_member_id' and image_status = 'A' ORDER BY image_id");
while($data = mysql_fetch_object($query)) {
$sql = "UPDATE image SET image_caption='image_caption' WHERE image_member_id = '$session_member_id' and image_status = 'A' ORDER BY image_id";
$result = mysql_query($sql);
if(! $result=mysql_query) {
echo "Error: " . mysql_error();
}
}
}
<script language="javascript">
function jp_caption(field) {
var agree = confirm("Are you sure you want to update the caption?");
if(agree) {
document.home.action = "<? echo $PHP_SELF; ?>?mode=caption";
document.home.submit();
}
}
<table cellpadding="0" cellspacing="0">
<?php if($data->image_caption == "") { ?>
<tr>
<td align="right"><font face="verdana" size="1">caption: </font></td>
<td colspan="2"><font face="verdana" size="1"><input type="text" name="image_caption" class="form" style="width: 200px;" value="<?php print($data->image_caption); ?>">
<a href="javascript:jp_caption();"><img src="./images/bu.update.gif" border="0"></a></font></td>
</tr>
<?php } else { ?>
<tr>
<td align="right"><font face="verdana" size="1">caption: </font></td>
<td colspan="2"><font face="verdana" size="1"><input type="text" name="image_caption" class="form" style="width: 200px;" value="<?php print($data->image_caption); ?>">
<a href="javascript:jp_caption();"><img src="./images/bu.update.gif" border="0"></a></font></td>
</tr>
<?php } ?>
<tr>
<td align="right"><font face="verdana" size="1">link: </font></td>
<td nowrap><font face="verdana" size="1"><input type="text" name="link<?php print($data->image_id); ?>" class="form" value="<?php print($page_url); ?>/hosted/<?php print($data->image_name); ?>.<?php print($data->image_ext); ?>" style="width: 380px;"> </font></td>
<td nowrap><a href="javascript:copyit('link<?php print($data->image_id); ?>');"><img src="./images/bu.copy.gif" border="0"></a></td>
</tr>
</table>
when i put an actual value into query " SET image_caption='image_caption'" it updates the database, but it updates ALL of the captions to the value. how can i fix that, and how can i do like a update image set image_caption=$image_caption so that itll update what was sent from the javascript?
thanks