inplace editor

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

inplace editor

Post by pleigh »

hi, i really need your help. :) i have this code from index.php

Code: Select all

<form id="inplace">
					<table border="="1" width="40%" cellpadding="0" cellspacing="0" id="edit_handle">
						<?php
							$rquery = "SELECT RightsKey, RightsDesc FROM hh_rights";
							$rresult = mysql_query($rquery) or die(mysql_error());
							$edit = 0;
							
							if ($rresult) {
								while ($row = mysql_fetch_array($rresult, MYSQL_NUM)) {
									$edit++;
									echo "<tr>
											<td><p id='edit$edit' name='rights' value='" . $row[0] . "'> " . $row[1] . "</p></td>
										  </tr>";
								}
							} else {
								echo "system error";
							}
						?>
						<script type="text/javascript">
						 new Ajax.InPlaceEditor('edit1', 'rights-edit.php');
						 new Ajax.InPlaceEditor('edit2', 'rights-edit.php');
						 new Ajax.InPlaceEditor('edit3', 'rights-edit.php');
						 new Ajax.InPlaceEditor('edit4', 'rights-edit.php');
						 new Ajax.InPlaceEditor('edit5', 'rights-edit.php');
						 new Ajax.InPlaceEditor('edit6', 'rights-edit.php');
						 new Ajax.InPlaceEditor('edit7', 'rights-edit.php');
						</script>
					</table>
				</form>
and then, my rights-edit.php

Code: Select all

$rk = $_GET['value'];
$v = $_GET['v'];

$query = "UPDATE hh_rights SET RightsDesc=$v WHERE RightsKey= '" . $rk . "'";
the problem now is that i cant edit the content on the database when i tried to click to ok that is generated by inplace editor, it will reflect the "Saving.." text and then it disappears, and my database is not updated. im not quite familiar with this.please help me. thank you in advance. :D
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Clean your code, then ask again. Also, this is, I suspect, primarily a Javascript issue, yet there is no mention of the JS code that pushes the updates.
Post Reply