Jump to content

Enable edit mode in a Dynamic HTML Table


jam123

Recommended Posts

Dear all Gurus,

 

I'm stucked with below logic. Wanna get your advice to find out where I went wrong.Please help....

 

Below is my Coding done using PHP.

A dynamic HTML table is generated text boxes in table Rows(Dissable mode) with EDIT & DELETE buttons. When user clicks on Edit button, particular row(Text Box) should be enable to edit the values generated.

 

But Unfortunately in my coding, always the fist row only gets enabled. :'(

 

<script type="text/javascript">

function m(id){

 

document.getElementById('Record_id').disabled=false;

document.getElementById('file_number').disabled=false;

return false;

                  }

        </script>

 

while ($rw = mysql_fetch_array($query1)) {
$k = $rw['Record_id'];
echo '<tr>';
echo'<form name = "t_data">';
echo '<td>'.'<input type="text" id="Record_id" name="Record_id"value="'.$rw['Record_id'].'" disabled="true" size ="5"/>'.'</td>';
echo '<td>'.'<input type="text" id="file_number" name="file_number" value="'.$rw['file_number'].'" disabled="true" size = "9"/>'.'</td>';
echo '</tr>';

echo '<tr>';
echo' <td>';
echo'<form action="dlt_grid.php" method = "GET">';
echo'<input type="submit" value="Delete">';
echo'<input type="hidden" name="hf" value="'.$k.'">';
echo'</form> ';
echo'</td>';
                   
echo' <td>';
echo'<input type="submit" id="'.$k.'" value="Edit" onclick = "return m(this.id)">';
echo'<input type="hidden" name="hf" value="'.$k.'">';
echo'</td>';
echo '</tr>';
echo'</form>';

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.