Posts

Showing posts from March, 2012

get key code in javascript

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script language="javascript"> function keyCode(evt,x)  {          var charCode = (evt.which) ? evt.which : event.keyCode ; alert(charCode); } </script> <input type="text" onkeyup="return keyCode(event , this)"  />

get File Extention name in php and javascript

// php  $ext = substr ( strrchr ($fileName, '.'), 1); // javascript var file = $('#txtfile').val(); ext = file. substr (file. lastIndexOf ('.')+1); alert(ext);

list of all jquery function

List of jquery function   

check uncheck all check box using javascript and jquery

Your ckname are name 1 name 2 name 3 name 4 name 5 name 6 Select / Unselect All <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script language="javascript"> function selectallCHBox(){ if($('#selectall').attr('checked')){ var inputs = document.getElementsByClassName('chechid'); var checkboxes = []; for (var i = 0; i < inputs.length; i++) {   if (inputs[i].type == 'checkbox') { inputs[i].checked =true; } } } else { var inputs = document.getElementsByClassName('chechid'); var checkboxes = []; for (var i = 0; i < inputs.length; i++) {   if (inputs[i].type == 'checkbox') { inputs[i].checked =false; } } } } </script> </head> <body> <form name="form1" onSubmit="return validate()"> Your ckname are <br> <input type="checkbox...

Add Bcc and CC in email on php

 if($cc!="") echo $headers .= "\r\nCc: ".$cc;  if($cc!="") $headers .= "\r\nCc: ".$cc; if($bcc!="") $headers .= "\r\nBcc: ".$bcc."\r\n\r\n";

Check Box Validation In javascript

Your ckname are name 1 name 2 name 3 name 4 name 5 name 6 <html> <head> <script language="javascript"> function validate() { var chksob = document.getElementsByName('ckname[]'); var checkchecked = false; for (var i = 0; i < chksob.length; i++) { if (chksob[i].checked) { checkchecked = true; break; } } if (checkchecked == false) { alert("Please select at least one Name ."); return false; } return true; } </script> </head> <body> <form name="form1" onSubmit="return validate()"> Your ckname are <br> <input type="checkbox" name="ckname[]" value="blue" id="blue"> name 1 <br> <input type="checkbox" name="ckname[]" value="red" id="red">name 2 <br> <input type="checkbox" name="ckname[]" value="green" id="gree...

select radio button using jquery

checked radio button using jquery ('#idOfRadio').attr("checked","checked"); <input type="radio" id="idOfRadio" name="idOfRadio" />

PHP Script for sending mail with attachment file

send email with attachment in php  code to send email with attachment in php  form.html <form action="sendmail.php" > <label> Name:</label> <input type="text" name="name" id="name" /> <label> email:</label> <input type="text" name="email" id="email" /> <label> Phone No:</label> <input type="text" name="ph" id="ph" /> <label> Message:</label> <input type="text" name="msg" id="msg" /> <label> Resume :</label> <input type="file" name="txtresume" id="txtresume" /> <input type="submit" name="send mail" value="send mail"  /> </form> sendmail.php <?php error_reporting ( 0 ); //ini_set('display_errors','off'); //ini_set('memory_limit', '-1'...

CakePHP Framework for XAMPP and WAMP

for run cakephp freamwork on XAMPP server change xampp/apache/conf/httpd.conf LoadModule rewrite_module modules/mod_rewrite.so remove # befor it for tutorial http://www.sitepoint.com/application-development-cakephp/ 1. download cakephp 2. app//Config/database.php // for database connection  3.  app//Config/core.php     line no : 187 // copy this cod or any other number value  Configure::write('Security.salt', '375698373538389654213024796542158345345435328930');   line no: 192  // copy this code or any other alphanumeric value   Configure::write('Security.cipherSeed', 'tyda1212dDSEASASdWayYui4deasd121212121sdsaEdrMnh');  4.Now go to  MOdel Folder and create " post.php " page  (page...

cut string in JavaScript using substr function

String : HH:MM:AMPM syntex :  var cutstr = string.substr(startIndex , Length) ;  CODE :-  <script> function cutstring(){ btime = 'HH:MM:AMPM '; var hh = btime.substr(0,2); var mm = btime.substr(3,2); var ampm =btime.substr(6,2); alert(hh); alert(mm); alert(ampm); } </script> <b> String :  HH:MM:AMPM </b> <input type="button" onclick="cutstring()" name="button" value="click " />

$.ajax method ,

$.ajax({   type: 'POST', // post , get   url: "file.php",   data: {name: "Rajeev", time: "2pm"},   success: function(result,status,xhr){    alert(result); alert(status); alert(xhr);   },   error: function(xhr,status,error){ alert(status);   }     });

submit form using javascript

submit form using javascript   submit form using javascript  submit form using javascript First name: Last name: <script type="text/javascript"> function formSubmit() { document.getElementById("formid").submit(); } </script> <form id="formid" action="myform.php"> First name: <input type="text" name="fname" /><br /> Last name: <input type="text" name="lname" /><br /><br /> <input type="button" onclick="formSubmit()" value="Submit form" /> </form>

how to copy data from one table to another table in mysql

INSERT INTO TABLE2 SELECT * FROM TABLE1 INSERT INTO TABLE2 (COL1, COL2, COL3) SELECT COL1, COL4, COL7 FROM TABLE1 copy table one database to another database CREATE TABLE database2.`tablename2` SELECT * FROM database1.`tablename1` NOTE: it must you have database1 , database2 and tablename1 Create similar table in mysql CREATE TABLE new_table_name LIKE tablename2; rename table in mysql RENAME TABLE table1 TO table2 ;

important url

1.   Format nice looking php source code http://phpgoogle.awardspace.com/index.php 2.  For Ajax Unipolar Image  // create image for lodar http://ajaxload.info/ 3.  aspect ratio calculator  http://andrew.hedges.name/experiments/aspect_ratio/ 4. Zend Demo Project Download  http://www.sitepoint.com/forums/showthread.php?565088-ZEND-For-Beginners-tutorial-projects 5.   Login in 000webhost. for hosting  6.  rajeevphp2011.netne.net

Call PHP Function In JavaScript Using Ajax

how to call php function from javascript function 1. create Folder on WWW Or htdocs (on your computer) 2. create index.php page on your folder and paste this code index.php <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>  <script> function addsearchproduct(x){   // this is JavaScript  function    $.ajax({   type: 'POST',   url: "function.php?f=phpFunction&p="+x,          // call php function , phpFunction=function Name , x= parameter     data: {},   success: function(data1){         alert(data1);   } });             } </script> <input type="button" value="call Php Function" onclick="...

Mail Script in PHP

//error_reporting(0); //ini_set('display_errors','off'); //ini_set('memory_limit', '-1');   <?php   if(isset( $_POST ) && !empty ( $_POST [ "txtname" ]) ){ $name  =  strip ( $_POST [ 'txtname' ]);  $mail  =  strip ( $_POST [ 'txtemail' ]);  $mobile  =  strip ( $_POST [ 'txtmobile' ]);  $headers  =   "From: " . $mail . "\r\n" ;  $headers  .=  'MIME-Version: 1.0'  .  "\r\n" ;  $headers  .=  'Content-type: text/html; charset=iso-8859-1'  .  "\r\n" ;  $headers  .=  "\r\nX-Mailer: PHP/"  .  phpversion ();  $subject  =  " Mail for related to your query " ; $message  =  "Name: "  .  $name  .  "<br> Mobile No: "  .  $mobile .  "<br/>Email Id:" . $...

Select All Check Box on clock

Imperative Object-Oriented Functional Select All Code :  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#selectAll").click(function() { var checked_status = this.checked; $("input[name=checkBoxName]").each(function() { this.checked = checked_status; }); }); }); </script> <input type="checkbox" name="checkBoxName" value="Imperative">Imperative<br> <input type="checkbox" name="checkBoxName" value="Object-Oriented">Object-Oriented<br> <input type="checkbox" name="checkBoxName" value="Functional">Functional<br><br> <input type="checkbox" id="selectAll">Select All<br>

Array Terminology In PHP

<?php // Create a  array in PHP .  $array  = array( 1 ,  2 ,  3 ,  4 ,  5 ); print_r ( $array );  // prient array value HERE echo  '<br> unset array <br>'  ; // Now unset all array element foreach ( $array  as  $i  =>  $value ) { unset( $array [ $i ]); } //print_r($array); // Append an item (after $array[4] , next value store in $array[5] ). echo  '<br> echo appending array <br>'  ; $array [] =  6 ; print_r ( $array ); // Restart index echo  '<br> echo Restart index array <br>'  ;  $array  =  array_values ( $array ); $array [] =  7 ; print_r ( $array ); ?>

Simple Function Example in PHP

<?php  function  first  () { function  second () { echo  'I am  first function.' ; } echo  'I am  second function.<br/>' ; } // here it must first you call function first()  then second()  function  first ();  // Print I am  second function  second ();  // Print I am  first function  ?> This example use for handle to multiple Function In php

simple costume function in PHP for Add Two Values

<?php  // firat method  function  add ( $a ,  $b ) { echo  $a + $b  ; } add ( 5 , 3 );  ?> <?php  // second method function  addsecond ( $a ,  $b ){ return  $a + $b ; } echo  addsecond ( 6 , 4 );  ?> <?php   // third method  function  addthird ( $a , $b ){ $c  =  $a + $b  ; return  $c  ; } echo  addthird ( 6 , 6 ); ?>

Create Constructor In PHP Example

<?php // constructor Example  class  class1  {  // create class  function  class1 (){  echo  'this is a simple constructor <br>'  ; }  // create constructor here  function  myname (){   // create function  echo  'my name is Rajeev Dhar Dwivedi<br>'  ; } function  addvalue ( $a ,  $b ){   //  create function  echo  $a + $b ; } }; ?> <?php $a  = new  class1 ();  // create object here $a -> myname ();    // call function here  $a -> addvalue ( 5 , 10 ); ?> OUTPUT : this is a simple constructor  my name is Rajeev Dhar Dwivedi 15

Create Class and Object In PHP simple Example

<?php class  class1  {  // create class  function  myname (){   // create function  echo  'my name is Rajeev Dhar Dwivedi'  ; } function  addvalue ( $a ,  $b ){   //  create another function echo  $a + $b ; } }; ?> <?php $a  = new  class1 ();  // create object here $a -> myname ();    // call myname() function here  echo  '<br>' ; $a -> addvalue ( 5 , 10 );  // call addvalue() function here  ?> OUTPUT : my name is Rajeev Dhar Dwivedi 15 

null inputbox on click using javaScript

code :  <input type="text" name="name" value="click here" onClick="(this.value='')" ;  />