Author: darshakkumar
-
how to remove any character using javascript?
I am removing only ” – (dash), . (dot), (space) in this exmple. function dotrm(cit) { var cl=cit.length; var ch=cit; for(l=0;l<=cl;l++) { if(cit[l] == ‘.’ || cit[l] == ‘ ‘ || cit[l]==’-‘) { ch=cit.replace(cit[l],”); } } document.getElementById(“city”).value=ch; }
-
how to backup mysql database using php?
<?php $backfile=”a.sql”; $command=”mysqldump -u root test>$backfile”;// system($command); ?>
-
how to validate password allow space in middle of string
function spc(str) { var l=str.length;//check length of string for(var i=0;i<l;i++) { if(str[0]==’ ‘ || str[str.length-1]==’ ‘)//check first & last character of password { document.getElementById(“spa_error”).innerHTML=’Space key cannot be used for the first or last character of your password’; }else { document.getElementById(“spa_error”).innerHTML=”; } } }
-
how to use trim() function in IE below version
Use this function in head section of your webpage and then use trim() function. if(typeof String.prototype.trim !== ‘function’) { String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ”); } }
-
How to add top and bottam pagination in datatable?
First open jquery.datatables.js file and find this.sDom = ‘lfrtip’; or this.sDom and then write below code inplace of previous code. this.sDom = ‘<“top”iflp>t<iflp>’;
-
How to validate multiple checkbox?
var adfa=0; var chk=document.getElementById(“tbl”);//table id for(var i=0;i < chk.rows.length;i++) { var inputs = chk.rows[i].getElementsByTagName(‘input’); if(inputs[0].checked==true) { adfa=1; } } if(adfa==1) { //alert(“true”); if(val==’delete’){ var ans=confirm(‘Are you sure want to delete?’); if(ans) document.forms[id].submit(); } }else { alert(“No entry was selected to be deleted”); }
-
PHP mail with attachment
<?php //Set Email Subject $subject = $_POST[‘sub’]; $message_email=$_POST[‘message’]; $message_email.='<br><br><br>’.$data; //define the from \ reply to headers $headers = “From: darshakkumarshah@mkics.in\r\nReply-To: darshakkumarshah@mkics.in”; //create a unique boundary string to delimit different parts of the email (plain text, html, file attachment) $random_hash = md5(date(‘r’, time())); //add boundary string and mime type specification $headers .= “\r\nContent-Type: multipart/mixed; boundary=\”PHP-mixed-“.$random_hash.”\””; //read…
-
Dynamic add and remove Textbox with numeric validation using javascript
<script type=’text/javascript’> // Numeric validations function numbersonly(e){ var unicode=e.charCode? e.charCode : e.keyCode if (unicode!=8){ //if the key isn’t the backspace key (which we should allow) if (unicode<48||unicode>57) //if not a number return false //disable key press } } // remove dynamic textbox function rem(inval) { $(“#my”+inval+”Div”).remove(); } // add dynamic textbox // ——————————————————– // Author…
-
Read the csv file and insert in mysql in php
<?php if($_SERVER[‘REQUEST_METHOD’]==’POST’) { $cmpname=”; $uplpath=”.”; $fname=$_FILES[‘upload’][‘name’]; move_uploaded_file($_FILES[‘upload’][‘tmp_name’],$uplpath.”/”.$fname); $handle=fopen($uplpath.”/”.$fname,”r”); if($handle) { while(!feof($handle)) { $str=fgets($handle,4096); $arr=explode(‘,’,$str); $cnt = count($arr); $cmp=$cmpname; if($cnt>1) { $nm=$arr[0]; $mail=$arr[1]; echo $q=”insert into test(name,email) values(‘$nm’,’$mail’)”; $r=mysql_query($q) or die(mysql_error()); header(“Location:result.php?suc=1”); } } } else { $m=1; } } ?> <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”> <html xmlns=”http://www.w3.org/1999/xhtml”> <head> <meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″…
-
How to hide folder without using any software?
cls @ECHO OFF title Folder Lock if EXIST “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” goto UNLOCK if NOT EXIST Lock goto MDLOCKER :CONFIRM echo Are you sure u want to Lock the folder(Y/N) set/p “cho=>” if %cho%==Y goto LOCK if %cho%==y goto LOCK if %cho%==n goto END if %cho%==N goto END echo Invalid choice. goto CONFIRM :LOCK ren Lock…
