Friday, 22 March 2013

PHP and Javascript's functions, solutions and usage


PHP and Javascript's functions, solutions and usage.



PHP get whole query string

To get whole query string:

echo $_SERVER["QUERY_STRING"];


// *************************************


Javascript lower and uppper case functions

<script>

var str="Hello World!";
document.write(str.toLowerCase());
document.write("<br>");
document.write(str.toUpperCase());

</script>


// *************************************

Javascript sub-string function and usage.

<script>
var str = "ENGLISH";
var n = str.substr(0,2);
document.write(n);
</script>


//  ************************************

PHP Redirect to url

header("location:http://www.google.com");

//  ************************************

Javascript Redirect to url

<script>

var urlStr = "http://www.google.com";

window.location.href=urlStr

</script>


//  ************************************

CakePHP redirect to url

$urlStr = "http://www.google.com";

$this->redirect($urlStr);

//  ************************************

No comments:

Post a Comment