edit data using modal php

Solutions on MaxInterview for edit data using modal php by the best coders in the world

showing results for - "edit data using modal php"
Clelia
01 Apr 2016
1<!DOCTYPE html>
2<html lang="en">
3<head>
4  <meta charset=UTF-8>
5  <meta name=viewport content="width=device-width, initial-scale=1.0">
6  <meta http-equiv="X-UA-Compatible" content="ie=edge">
7
8  <link rel="stylesheet" href="//stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin=anonymous>
9
10  <script src=//code.jquery.com/jquery-3.3.1.slim.min.js integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin=anonymous></script>
11  <script src=//cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin=anonymous></script>
12
13  <script src=//stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin=anonymous></script>
14
15  <script
16  src=//code.jquery.com/jquery-3.5.1.slim.js
17  integrity="sha256-DrT5NfxfbHvMHux31Lkhxg42LY6of8TaYyK50jnxRnM="
18  crossorigin=anonymous></script>
19   
20  <title>Document</title>
21</head>
22<body>
23  <div >
24   <div >
25     <div ></div>
26     <div >
27      <table >
28        <thead>
29         <tr>
30          <th>#</th>
31          <th>Course Name</th>
32          <th>Duration Hours</th>
33          <th>Exam Date</th>
34          <th>Action</th>
35         </tr>
36        </thead>
37        <tbody>
38    
39         <tr>
40          <th scope="row">1 </th>
41          <td>Computer</td>
42          <td>255 Hours</td>
43          <td>25-04-2020 </td>
44          <td><a href="javascript:;" data-toggle="modal" data-target="#addModal" data-id="1" data-name="Computer" data-duration="255" data-date="27-04-2020" > Edit</a></td>
45         </tr>
46         <tr>
47          <th scope="row">2 </th>
48          <td>Data Science</td>
49          <td>300 Hours</td>
50          <td>27-04-2020 </td>
51          <td><a href="javascript:;" data-toggle="modal" data-target="#addModal" data-id="2" data-name="Data Science" data-date="27-04-2020" data-duration="300" > Edit</a></td>
52         </tr>
53         
54        </tbody>
55       </table>
56     </div>
57     <div ></div>
58   </div>
59  </div>
60
61
62
63
64   
65<script>
66  $('.addAttr').click(function() {
67  var id = $(this).data('id');   
68  var name = $(this).data('name'); 
69  var duration = $(this).data('duration');   
70  var date = $(this).data('date');   
71
72  $('#id').val(id); 
73  $('#name').val(name); 
74  $('#duration').val(duration); 
75  $('#date').val(date); 
76  } );
77 </script>
78 <div id="addModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
79  <div role="document">
80    <div >
81     <div >
82       <h5 id="exampleModalLabel">Modal Title </h5>
83       <button type=button data-dismiss="modal" aria-label="Close">
84       <span aria-hidden="true">×</span>
85       </button>
86     </div>
87     <form action="" method="POST">
88      
89       <div >
90
91        <div >
92          <label for="exampleInputEmail1">Course Id</label>
93          <input type=text id="id" name=id required>
94        </div>
95        <div >
96          <label for="exampleInputEmail1">Enter Course Name</label>
97          <input type=text id="name" name=name required>
98        </div>
99        <div >
100          <label for="exampleInputEmail1">Enter Course Duration <small> (In hours)</small> </label>
101          <input type=text id="duration" name=duration value="" required >
102        </div>
103        <div >
104          <label for="exampleInputEmail1">Date </label>
105          <input type=text id="date" name=date value="" required >
106        </div>
107       </div>
108       <div >
109        <button type=button data-dismiss="modal">Close</button>
110        <button type=submit >Save changes</button>
111       </div>
112     </form>
113    </div>
114  </div>
115 </div>
116</body>
117</html>