Archive for the ‘coding technique’ Category

Page 2 of 212

Php function to validate two decimal places of a number

If you are looking for the validation of a number which contains only two decimal places. Means you want to accept the values like 0.21 or 1.34 or 12.55 or 445.66 as a input and throw an error when somebody enters the number like 0.2 or 4.678 from a text box. Here is a simple function for you in PHP which validates the number weather it contains exactly two decimal places or not. Full story

Register Globals ( register_globals ) “on” security problem in PHP

Do you know what happend when register_globals is set to ON in php.ini?? When it is set to ON it registers Environment, GET, POST, COOKIE or Server variables as global variables i.e. you don't need to write $_POST to access the posted 'username' variable you can simply use '$username' to access the $_POST. Full story

How to return value from Ajax Function – Use synchronous request

Have you ever tried to return values from the Ajax function ? Well it might be sometime the cases when you might have to return the value got from the server to another function rather than updating the component. Let's try to return the values from the traditional Ajax function. Full story

Clean and efficient coding technique in PHP

Well there are lots of discussion regarding what the actual "clean code" is. At the end of the day you can find there are mainly two criterion for clean code: Full story
Page 2 of 212
Copyright © 2012 Roshan Bhattarai's Blog. All rights reserved.
Powered by WordPress.org, Custom Theme and ComFi.com Calling Card Company.