editable table ajax
<div class='container'>
<table width='100%' border='0'>
<tr>
<th width='10%'>S.no</th>
<th width='40%'>Username</th>
<th width='40%'>Name</th>
</tr>
<?php
$query = "select * from users order by name";
$result = mysqli_query($con,$query);
$count = 1;
while($row = mysqli_fetch_array($result) ){
$id = $row['id'];
$username = $row['username'];
$name = $row['name'];
?>
<tr>
<td><?php echo $count; ?></td>
<td>
<div contentEditable='true' class='edit' id='username_<?php echo $id; ?>'>
<?php echo $username; ?>
</div>
</td>
<td>
<div contentEditable='true' class='edit' id='name_<?php echo $id; ?>'>
<?php echo $name; ?>
</div>
</td>
</tr>
<?php
$count ++;
}
?>
</table>
</div>
4.11
9
.edit{
width: 100%;
height: 25px;
}
.editMode{
border: 1px solid black;
}
/* Table Layout */
table {
border:3px solid lavender;
border-radius:3px;
}
table tr:nth-child(1){
background-color:dodgerblue;
}
table tr:nth-child(1) th{
color:white;
padding:10px 0px;
letter-spacing: 1px;
}
/* Table rows and columns */
table td{
padding:10px;
}
table tr:nth-child(even){
background-color:lavender;
color:black;
}
Thank you!
9
0
Are there any code examples left?
New code examples in category Javascript
-
Javascript 2023-04-21 22:52:36
-
Javascript 2022-03-27 22:25:20 javascript download string as file
-
Javascript 2022-03-27 21:40:22 sort numbers in array javascript
-
Javascript 2022-03-27 21:20:04 compare two arrays and return the difference javascript
-
Javascript 2022-03-27 21:15:02 javascript regex french phone number
-
Javascript 2022-03-27 21:05:03 cypress custom error message
-
Javascript 2022-03-27 21:00:05 create element javascript with id
-
Javascript 2022-03-27 20:40:57 feather icons react
-
Javascript 2022-03-27 20:20:01 how to make graphql request in axios
-
Javascript 2022-03-27 20:15:07 bootstrap validator password and confirm password