Archive for July, 2012

quick fix | No Comments | July 16th, 2012

Hoe to get folder name from current page

Use this function

function getCurrentDirectory() {
$path = dirname($_SERVER[‘PHP_SELF’]);
$position = strpos($path,’/’) + 1;
return substr($path,$position);
}

 

echo getCurrentDirectory();

javascript | No Comments | July 10th, 2012

function checkAll(field) {
	for (i = 0; i < field.length; i++)
	field[i].checked = true;
}

<form  method="post" action="" name="myform">
<input type="checkbox" name="checkboxname[]" value="1">
<input type="checkbox" name="checkboxname[]" value="2">
<input type="checkbox" name="checkboxname[]" value="3">
<input name="CheckAll" type="button" value="Select All"  onclick="checkAll(document.myform['checkboxname[]'])" />
</form>