Day 3 – Variables

Variable: variable is name of place where computer holds the value temporarily in computer’s memory (RAM), that we can use in our program. In PHP variable is defined with “$” sign. In below program “$a” is a variable contain an integer value “23”, “$b” contain string value “Albert” and $c contain float value “232.44”. Program […]

Day 2 – Some basic programs in PHP

Now let’s write and run some basic programs in PHP. Program 1: Program to print “Welcome to php” in PHP. Open notepad++ and write below lines of code: <?php echo “Welcome to php”; ?> Save this program in C://xampp/htdocs/welcome.php Note: if xampp is not installed in C:// then save your program which ever drive xampp […]

Day 1 – Introduction to PHP

PHP is server side scripting language to develop dynamic websites. PHP developed in 1995 by Rasmus Lerdorf. Early versions PHP was called Personal Home Page but it not seem to be a technical, so PHP rename “Hypertext Preprocessor”, or we can say “Personal Home Page Hypertext Preprocessor”. Advantages of PHP:- Its free. Open source. Easy […]

Database Connectivity in Php

This blog is going to explain how to connect database with php and display all the records of table. STEP 1: Create a table and insert some records in it. create table emp (id int, name varchar(50), salary int, phone varchar(20)); insert into emp values (1,’Albert’,56000,’98587485768′); insert into emp values (2,’Robart’,58000,’98587485768′); insert into emp values […]

Regular Expressions in JavaScript

With the help of Regular Expressions we can make our own patterns for validation and validate form as per our requirement. This post will describe how you can make your own regular expression in JavaScript. var exp = /^ $/; Above is the syntax how to define the expression in JavaScript. Between /^ $/ we […]

Minimum Character Validation

In JavaScript we can check the numbers of characters entered in Text Box and validate minimum or maximum numbers of characters in textbox. example: <html> <script> function validate() { var password = document.myForm.txtPassword.value; if(password.length

Required Field Validation

One of the important use of JavaScript is Client Side Validations. We can validate the form’s data before sending to the server. example: Required Field Validation (can’t leave the field blank) <html> <script> function validate() { var name = document.myForm.txtName; if(name.value.trim()==””) { alert(“Please enter name”); name.focus(); return false; } else { return true; } } […]

“this” Keyword

“this” refer to the object on which a method is being invoke. We can pass “this” as an argument in function, as in given examples: example 1 <html> <head> <script type=”text/javascript”> function focusTr(objTr){ objTr.style.background =”yellow”; objTr.style.color =”red”; } function unFocusTr(objTr){ objTr.style.background =”white”; objTr.style.color =”black”; } </script> </head> <body>

Populate Div with JavaScript

We can fill div dynamically with the help of JavaScript, using innerHTML. As the example given below. <html> <head> <script type=”text/javascript”> function fillDiv(){ var sub = document.getElementById(‘msgDiv’); var txtVal = document.getElementById(‘txt’).value; sub.innerHTML = “Entered Text is “+txtVal; } </script> </head> <body> Enter Text : <input type=’text’ id=”txt”/> <input type=”button” onclick=”fillDiv()” value=”Show”/> <div id=”msgDiv”> </div> </body> […]

Customize the WordPress Search

We can change the design and add additional fundability in the search widget provided by WordPress. Make a file “searchform.php“ in your theme folder and add the blow given code. You can also add your style or script as need in this file. <?php /** * The template for displaying Search Results pages * * […]