Author Archive
Comment code is a line that is not executed as a part of the program. It’s only readable by someone who is editing the code! Comments are useful for Documentation to let other members of your team understand what you were doing in your code. PHP supports three ways of commenting: <?php // This is
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
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
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
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
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
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
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” 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>
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>