JQuery Drop Down Menue

I have created a menu using jQuery and CSS. I have used jQuery Toggle function to show and hide the drop down menu. Following is the code;

Code 

Advertisements

News Portal Using Codeigniter

I have created a news portal using PHP, Codeignitor, JQuery, Bootstrap. In this project, you  can register user and then login to post news. The main page of the project displays news posted by user. The following is the code;

Code

Check/Uncheck Group of CheckBoxes

Javascript Code

<!DOCTYPE html>
<html>
<head>
<title>Check and Uncheck ALL check Boxes</title>
<meta charset=”UTF-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>

<script type=”text/javascript”>
function checkAll(formname, checktoggle)
{
var checkboxes = new Array();
checkboxes = document.forms[formname].getElementsByTagName(‘input’);

for (var i = 0; i < checkboxes.length; i++) {
if (checkboxes[i].type === ‘checkbox’) {
checkboxes[i].checked = checktoggle;
}
}
}
</script>
</head>
<body>
<form name=”myform”>
<li>
<label >
<a href=”javascript:void();” onclick=”javascript:checkAll(‘myform’, true);”>Check All</a> |
<a href=”javascript:void();” onclick=”javascript:checkAll(‘myform’, false);”>UnCheck All</a>
</label>
</li>
<li>
<input type=”checkbox” name=”content1″ value=”1″>
</li>
<li>
<input type=”checkbox” name=”content2″ value=”2″>
</li>
<li>
<input type=”checkbox” name=”content3″ value=”3″>
</li>
</form>
</body>
</html>

JQuery Code

<!DOCTYPE html>
<html>
<head>
<title>Check and Uncheck ALL check Boxes</title>
<meta charset=”UTF-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
<script src=”jquery-1.11.3.js”></script>
<script type=”text/javascript”>
$(document).ready(function(){
$(“#checkall”).click(function () {
$(‘input:checkbox’).not(this).prop(‘checked’, this.checked);
});

});
</script>
</head>
<body>
<form name=”myform”>
<li>

<input type=”checkbox” id=”checkall” name=”checkall”>
<label >check/uncheck</label>
</li>
<li>
<input type=”checkbox” name=”content1″ value=”1″/>
</li>
<li>
<input type=”checkbox” name=”content2″ value=”2″/>
</li>
<li>
<input type=”checkbox” name=”content3″ value=”3″/>
</li>
</form>
</body>
</html>

Restful web services using slim and PHP

I have created a restful webservices using slim framework and PHP. I have created APIs for simulation atm machine.  In my case, ATM machine is PC and PC have uniquie name and password. The PC information is save in a file in jSOn format (serviceconfig.txt);

{“Machines”:[{“name”:”PC1″,”password”:”test”}]}

If you want to add another machine, add it in the above jSon..

And user information is saved in file(2007_1.txt);

{“User”:[{“name”:”Jawad”,”user_id”:”2007″,”pin”:1234,”balance”:49900}]}

If you want to create another user ,you will create another file having name userid_1.txt.

And its mini statement info is a save in userid_2, which is automatically created.

Following work of atm is simulated;

  • Enter a 4 digit user id here to simulate a card scan.

Its is handled with post method with name and password.

http://localhost/atm-services/login

  • Enter PIN screen

It is also handled with post method with name, password, userId and pin.

http://localhost/atm-services/pin

  • Balance check

It is handled with get method.

http://localhost/atm-services/balance/PC1/test/2007/1234

  • Cash withdrawal

It is also handled with post method with name, password, userId, pin and amount to withdraw.

http://localhost/atm-services/cashwithdraw

 

  • PIN change

It is also handled with post method with name, password, userId, pin and changepin.

  • Mini statement

It is handled with get method.

http://localhost/atm-services/ministatement/PC1/test/2007/1234

Code