all i want is to make the user able to edit when he clicks on the value and on blur the value get edited
like it works here in the forum ,when i try to edit,it edited on the same page !! and i got this code,it works fine if i changed the update statement to insert
but in updating , it doesnt update anything and when i echoed the statement it gave me that:

update porto set porto_name = 'Websss' where porto_ID=''

and this is the code

	<script type="text/javascript">   
	 var contents = '';    
	 function toggle(porto_ID)

		 if (document.getElementById('r_'+porto_ID).style.display == 'none') 
			 if (document.forms['form_'+porto_ID].porto_name.value != contents)  
			 // If the contents of the box have changed, submit the form.    
			 document.getElementById('w_'+porto_ID).style.display = 'none';
			 document.getElementById('r_'+porto_ID).style.display = 'inline';    
			 document.getElementById('w_'+porto_ID).style.display = 'inline';     
			 contents = document.forms['form_'+porto_ID].porto_name.value; 
			 document.getElementById('r_'+porto_ID).style.display = 'none';    
$Recordset1=mysql_query("select * from porto");
 <table >
 <?php do{ ?> 
			 <div id="r_<?php echo $row_Recordset1['porto_ID']; ?>" onclick="toggle('<?php echo $row_Recordset1['porto_ID']; ?>')">
				<?php echo $row_Recordset1['porto_name']; ?> 
			 <div id="w_<?php echo $row_Recordset1['porto_ID']; ?>" style="display: none;"> 
				<form id="form_<?php echo $row_Recordset1['porto_ID']; ?>" method=post
				 action=<?php echo $_SERVER['PHP_SELF']; ?> >
				 <input onblur="toggle('<?php echo $row_Recordset1['porto_ID']; ?>')"
				 name="porto_name" value='<?php echo $row_Recordset1['porto_name']; ?>' />    
 <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>

$query_line = "update porto set porto_name = '". $porto_name ."' where porto_ID='".$porto_ID."'";

$sql = mysql_query($query_line);
if(@$sql) echo mysql_error() . $query_line;

This article has been dead for over six months. Start a new discussion instead.