File manager - Edit - /home/autoph/public_html/ahglegal/ajs/main.html
Back
<html> <body> <script type="text/javascript" src="vendors/bower_components/angular/angular.min.js"></script> <!--<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"></script>--> <div ng-app = "myApp" ng-controller="cntrl"> <form> Student ID: <input type="text" ng-model="id" name="id" ng-disabled="obj.idisable"> Student Name: <input type="text" ng-model="name" name="name"> <input type="button" value="{{btnName}}" ng-click="insertdata()"> </form> <table> <thead> <tr> <th>Name</th> <th>Roll No</th> </tr> </thead> <tbody> <tr ng-repeat="student in data"> <td>{{student.studid}}</td> <td>{{student.studname}}</td> <td><button ng-click="deleteStud(student.studid);">Delete</button></td> <td><button ng-click="editStud(student.studid,student.studname);">Edit</button></td> </tr> </tbody> </table> </div> <script> var app=angular.module('myApp',[]); app.controller('cntrl', function($scope, $http){ $scope.obj={'idisable':false}; $scope.btnName="Insert"; $scope.insertdata=function(){ $http.post("insert.php",{'id':$scope.id, 'name':$scope.name, 'btnName':$scope.btnName}) .success(function(){ $scope.msg="Data Inserted"; $scope.displayStud(); }) } $scope.displayStud=function(){ $http.get("select.php") .success(function(data){ $scope.data=data }) } $scope.deleteStud=function(studid){ $http.post("delete.php",{'id':studid}) .success(function(){ $scope.msg="Record Deleted" $scope.displayStud(); }) } $scope.editStud=function(studid,studname){ $scope.id=studid; $scope.name=studname; $scope.obj.idisable=true; $scope.btnName="Update"; $scope.displayStud(); } }); </script> </body> </html>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings