jquery show hide element

There is many way to show hide elements using jQuery. 1.$(“#yourElement”).show(); $(“#yourElement”).hide(); 2.$(“#yourElement”).toggle(); 3.$(“#yourElement”).css(“display”, “none”); $(“#yourElement”).css(“display”, “block”);

Read more

php check valid username

You can check username is valid or not using regular expression.Regular expression is strong part of php.You can also use perl style of regular expression in php.The bellow given php function will allow only alpha numeric and underscore character.You can free to use this function in your project or scripts. Function function validate_username($username) { return preg_match(‘/^[A-Za-z][A-Za-z0-9]*(?:_[A-Za-z0-9]+)*$/’,$username); }

Read more

ajax username availability

How to check username availability in php jquery ?.You can check username availability using jquery ajax post request.You can also use ajax start,ajax stop and other ajax function.When ajax start you can show loading and when ajax request complete you can hide it.You can free to use this script and modify also. Jquery username check function <script type=”text/javascript”> $(document).ready(function() {

Read more

php remove newline from string

You can remove new line character any where in string using regex preg_replace.preg_replace is function which work on regex to search and replace in string.Regular express is strong part of php.You can also search replace html tags.Here I have used regex string feature to search and replace new line character. Here is example how you can remove new line anywhere

Read more

php submit form to self

Submitting form to self page is easy.Just what you have to do is set form action method to blank.Leaving form action blank will submit form to itself. For submitting php form itself keep your php code to top of php page and php html form code to bellow your php code.In your php code a top please use isset($_POST) condition

Read more

php remove from array

This is very simple in php.There is function called “unset()”.Which You can use to remove array element.what you have to do is pass array name and element key to which you want to remove. here is just simple example $arr=array(0=>’string1′,1=>’string2′,3=>’string3′); unset($arr[1]); //will remove second element from array

Read more

php remove space inside string

You can remove space any where in string using regex preg_replace.preg_replace is function which work on regex to search and replace in string.Regular express is strong part of php.You can also search replace html tags.Here I have used regex string feature to search and replace space. Here is example how you can remove space anywhere in php $str = ‘nik

Read more

php get root path

$_SERVER is an array containing information such as headers, paths, and script locations. The entries in this array are created by the web server. There is no guarantee that every web server will provide any of these; servers may omit some. You can get root path in php using $_SERVER[‘DOCUMENT_ROOT’]. What is $_SERVER[‘DOCUMENT_ROOT’] ? The document root directory under which

Read more

php get date from timestamp

Its very easy in php to convert any valid timestamp value to php date time.The date() function and getdate() function do exactly what you required.here I am presensting some of example how to convert valid timestamp to php //php_get_date_from_timestamp.php $timestamp=time()-86400; //This is for just example Previouse day timestamp $date=date(“m/d/Y h:i:s A'”,$timestamp); echo $date; //another Way $DateArr=getdate($timestamp); echo $DateArr[‘mon’].’/’.$DateArr[‘mday’].’/’.$DateArr[‘year’].’ ‘.$DateArr[‘hours’].’:’.$DateArr[‘minutes’].’:’.$DateArr[‘seconds’] ;

Read more

php get url parameters

If you are looking for get url parameters in php then no need to write any logic or condition for getting it.Php has in built function called as “parse_url” this function return as array with parameter like host,path,query,fragment and more options.For more explanation please refer bellow given example. $url = ‘http://www.my-php-scripts.net/index.php?arg=value&args2=dfsdfsf#anchor’; print_r($url); This will return following Array ( [scheme] =>

Read more
1 2 3 4 5 6 7