Enter Keyword Hear for Search This Blog

Thursday, 31 August 2017

update

update

1.COOKIES

=> SETTING A COOKIE  

Syntax : 

Set-cookie:NAME=value;EXPIRES=date;PATH=path;DOMAIN=domain;SECURE
The NAME=value is the only required piece of information that must be included in the set-cookie field .
All other entries are optional.

Example :

<html>
  <head>
    <script>
      function newcookie(cookiename, value)
      {
         document.cookie=cookiename+"="+value;
      }
    </script>
  </head>
  <body>
     <script>
       document.write('<form>');
         document.write('<table border="0" width="100%">');
           document.write('<tr>');
             document.write('<td width="25%">First Name</td>');
              document.write('<td width="25%">
                 <input type="text" name="first_nm"                                   onBlur="newcookie(this.name,this.value);"
                 Size="20" type="text" value="'+cfirst_nm+'">
                 </td>');
             document.write('</td>');
           document.write('</tr>');
         document.write('</table>');
       document.write('</form>');
    </script>
  </body>
</html>

2.VALIDATION

2.1 Field Name cannot be left empty
------------------------------
/* Cheking if the variable for Client's name is empty,(i.e.a blank Client's name field was submitted .) */

if(empty($_POST['txtName']))
{
   /*returning data entry form if the Client's name is empty.*/
   $alertmessage="<center>
                   Filed for Client\'s Name is empty!
                  </center>";
   inclide("page2.php");
   exit;
}

2.2 No double spacing in the field name captured
-----------------------------------------
=> To test double spacing validation,insert double spaces in between the Client Name and click submit button .
=> The PHP code checks the contents of Client Name field returned by the Browser. As it has double spacing,an error message is generated and stored in the variable $alertmessage.

ereg("([[:space:]]{2})",$_POST["txtName"]);
------------------------------------------------------------------------------
else
{
     if(ereg("([[:space:]]{2})",$_POST["txtName"]))
  {
     /*
       returning data entry form if the Client's name contains             double spaces.
     */
     $alertmessage="<center>
                     Double spaces found in Client\'s Name!
                    </center>";
     inclide("page2.php");
     exit;
  }
}
--------------------------------------------------------------------------------------------------------

basic code

Basic Code

1. How to create one form

<html>
  <head>
    // you have put hear any meta tag or css depended on you.
  </head> 
  <body>
        <form action="process.html" method="post">
           Name : <input type="text" name="nm"/><br/>
           Add : <input type="text" name="add"/><br/>
           Mo No : <input type="text" name="no"/><br/>
           Other : <input type="text" name="otr"/><br/>
        </form>
  </body>
</html>
 
2. How to use switch case

switch (num)
     {

           case 1: alert("One");

           break;

           case 2: alert("Two");

           break;

           case 3: alert("Three");

           break;

           case 4: alert("Four");

           break;

           case 5: alert("Five");

           break;

                  

           default: alert("Select 1 to 5 Number");
    }

3. How to create array using script

var demo = new array();

                      demo[0] = new array();

                      demo[0][0]='A0';

                      demo[0][1]='B0';

                      demo[0][2]='C0';



                      demo[1] = new array();

                      demo[1][0]='A1';

                      demo[1][1]='B1';

                      demo[1][2]='C1';



                      demo[2] = new array();
                      demo[2][0]='A2';
                      demo[2][1]='B2';
                      demo[2][2]='C2';

       

                      document.write("A : "+demo[0][0]+"<br/>");

                      document.write("B : "+demo[0][1]+"<br/>");

Featured post

what is ajax?how to create ajax with php code

Ajax Introduction -  એજેક્સ નો ઉપીયોગ કરી ને તમે પેજ લોડ કાર્ય વિના બધી માહિતી મેળવી શકો.એજેક્સ થી તમે કોઈ પણ ડેટા ઝડપ થી મેળવી શકો છો...