Wednesday, July 11, 2007

Submit form with jQuery

Submit form with jQuery


posting.php file
<script language="javascript" src="js/jquery-1.6.3.min.js" type="text/javascript"></script>
<form id="myform" name="myform" action="postdata.php" method="post">
  <input type="text" id="nm" name="nm" />
  <input type="submit" value="Go" />
  <span id="errorspan"></span>
</form>
<div id="banner">
  Submit form with jQuery.
</div>
<script>
$('#myform').submit(function() {
  if($("#nm").val()=="") {
      $("#errorspan").text("Not valid!").show().fadeOut(3000);
      return false;
  } else {
      return true;
  }
});

$('#banner').click(function() {
  $('#myform').submit();
});
</script>



postdata.php file
<?php
echo $_POST['nm'];


?>


Wednesday, July 4, 2007

Show all objects of LDAP Server in PHP

Show all objects of LDAP Server in PHP

<?php
//$ldapServer = "ldap://111.222.111.222:389";

$ldapServer = '111.222.111.222';
$ldapBase = 'DC=abc,DC=com';
$ldapConn = ldap_connect($ldapServer);
if (!$ldapConn)
{
  die('Cannot Connect to LDAP server');
}
$ldapBind = ldap_bind($ldapConn);
if (!$ldapBind) {
  die('Cannot Bind to LDAP server');
}
ldap_set_option($ldapConn, LDAP_OPT_PROTOCOL_VERSION, 3);
$ldapSearch = ldap_search($ldapConn, $ldapBase, "(cn=*)");
$ldapResults = ldap_get_entries($ldapConn, $ldapSearch);
for ($item = 0; $item < $ldapResults['count']; $item++) {
  for ($attribute = 0; $attribute < $ldapResults[$item]['count']; $attribute++) {
    $data = $ldapResults[$item][$attribute];
    echo $data.":&nbsp;&nbsp;".$ldapResults[$item][$data][0]."<br>";
  }
  echo '<hr />';
}
?>

Wednesday, June 13, 2007

make single line paragraph in word

Make single line paragraph in word. 

There is a very common double paragraph problem in Microsoft word. and you want to set it in single line paragraph. follow the listed below steps.
1) Select the matter which you want to convert in single line paragraph.
2) Right click and select paragraph and set the listed below parameter:

General:::::::::
Alignment: left
Outline level: Bodytext
Indentation::::::
Left=0"    Right=0"   Special=(none)     By=Empty
Mirror indents=uncheck
Spacing::::::::::
Before= 0 pt       After=0 pt   Line Spacing =At least
At=5 pt