Jump to content
php.lv forumi

Tabulas šūnas rediģēšana


Mabus

Recommended Posts

Sveiki,

Man radās problēma ar tabulas šunu rediģēšanu :(((. Tabula tiek izveidota no tiem datiem, kuri atrodas datu bāzē. Pēc lietotāja vēlēšanās tas var rediģēt nosaukumu uzpiežot uz attēla, kuram jānodrošina input parādīšanos vecā nosaukuma vietā un jauna attēla parādīšanos - saglabāt, rediģēšanas attēla vietā. Nekā nevaru iegūt, lai notiek tā mainīšanās $quest_name pret input un attēlu mainīšanos. Ja varat, iesakiet, lūdzu, kādu paragu vai paņēmienu/veidu kā to panākt. Paldies.

 

[koda fragments, kurs izveido tabulu]

<?php

if(isset ($_SESSION['myusername'])){

$query = mysql_query ("select S.quest_name, S.registration_date, S.searchingid from searchings S,

members M where S.userid = M.userid AND M.username = '".$_SESSION['myusername']."' order by S.registration_date ASC");

$count=mysql_num_rows($query);

for ($i=1;$i<=$count; $i++ )

{

$row = mysql_fetch_assoc($query);

$quest_name=$row['quest_name'];

$date = $row['registration_date'];

$id = $row ['searchingid'];

 

?>

 

<tr id="note">

<td class="note_date"><?php echo $date ?></td> <!--izvadam uz ekrana meklejuma registracijas datumu-->

<td class="note_text" > <!-- izvadam uz ekrana meklejuma nosaukumu -->

 

<pre class ="pre"><?php echo $quest_name?></pre>

<div class = "box"> <!-- iedladejot nav redzams ievadlauks-->

<input type="text" class="quest_edit" name ="edit" />

<input type="hidden" Name = "edit_new" value = <?php echo $id; ?> class="quest_edit" />

</div>

</td>

 

<td>

<input class="updateNote" type ="image" src = "images/rew.png"

name="update"/> <!-- ieladejot lapu paradas attels, kurs nodrosina redigesanas lauku paradisanos-->

 

 

 

<input class="saveNote" type ="image" src = "images/save.png"

name="save" value = <?php echo $i ?> /> <!-- ja lietotajs izvelejas rediget meklejuma nosaukumu paradas cits attels-->

</td>

 

<td> <input class="removeNote" type ="image" src = "images/del.png"

name="delete" /></td>

</tr>

<?php

}

}

?>

</tbody>

</table>

</form>

</div>

Link to comment
Share on other sites

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"> </script>
<script>
var ls;
$(function(){
 $('#et').click(function(e){
   if (e.target.tagName=='TD'){  
     if (ls){
       ls.html(ls.find('textarea').val());
     }
     ls=$(e.target);    
     ls.html('<textarea>'+ls.html()+'</textarea>');
     ls.find('textarea').focus();
   }
 });
});
</script>
<style>
#et{
 border-collapse:collapse;
}
#et td{
 border:1px solid #888;
}
#et td textarea{
 border:0px;
 width:100%;
 height:100%;
}
</style>
</head>
<body>
<table id="et">
 <tr>
   <td>Hello world</td>
   <td>Hello world</td>
   <td>Hello world</td>
 </tr>
   <tr>
   <td>Hello world</td>
   <td>Hello world</td>
   <td>Hello world</td>
 </tr>
   <tr>
   <td>Hello world</td>
   <td>Hello world</td>
   <td>Hello world</td>
 </tr>
</table>
</body>
</html>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...