Friday, November 19, 2010

How to use the JavaScript in our Webpage HTML

JavaScript Starting and Ending with Script Tags <Script>

Tags Starting with <script type = text/javascript> and ending with </script>.

Syntax of JavaScript:
<html> 
   <body> 
     <script type="text/javascript"> 
        ... //Place the JavaScript code 
     </script> 
   </body> 
</html>

JavaScript can be placed in various locations in HTML such as Place between the Head Part and body

Example for Placing JavaScript- Head part in the HTML
<html> 
   <head> 
     <script type="text/javascript"> 
        .....
        ..... // HEAD Section JavaScript
     </script> 
   </head>


   <body>
   </body>
</html>
Example for Placing JavaScript- Body  part in the HTML
<html> 
   <head> 
   </head>


   <body>
     <script type="text/javascript"> 
        .....
        ..... //BODY Section JavaScript
     </script> 
   </body>
</html>
Example for Placing JavaScript on Both Places Head, Body  part in the HTML
<html> 
   <head> 
     <script type="text/javascript"> 
        // HEAD Section JavaScript
        document.write("JavaScript placed in HEAD Section")
     </script> 


   </head>


   <body>
     <script type="text/javascript"> 
        // BODY Section JavaScript
        document.write("JavaScript placed in BODY Section")
     </script> 
   </body>
</html>

Example for Print values using Write In JavaScript in the HTML

JavaScript output to a page is document.write.  The document.write command takes the argument as the text required for producing output.
<html> 
   <head> 
     <script type="text/javascript"> 
        // HEAD Section JavaScript
        document.write("JavaScript placed in HEAD Section")
     </script> 


   </head>


   <body>
     <script type="text/javascript"> 
        // BODY Section JavaScript
        document.write("JavaScript placed in BODY Section")
     </script> 
   </body>
</html>

By PHP with No comments

JavaScript Table of Contents


  1.  JavaScript Introduction
  2. JavaScript How to Work
  3. JavaScript Write
  4. JavaScript Html Tags
  5. JavaScript Alert Msg
  6. JavaScript Variables
  7. JavaScript Loops
  8. JavaScript Date
  9. JavaScript Array
  10. JavaScript Functions

By PHP with No comments

Introduction About JavaScript

Netscape developed the client side scripting language called JavaScript. JavaScript used along with HTML to build an efficient web site / webpage.


In Starting stage, all the websites developed only in the static pages using HTML. On that time, not able to develop the dynamic action pages in the web based information’s.


JavaScript’s used as following way,

create dynamic changes, validate forms, detect visitor details, create/use cookies



JavaScript is never confused with Java. Sun Microsystems developed Java and it’s not liked with JavaScript


There are two types of script languages server side and client side.

All the major browsers are supports the javascript such as Internet Explorer, Mozilla, Firefox, Netscape, Opera, Safari and more.

By PHP with No comments

Thursday, November 18, 2010

PHP File Extensions

PHP files are following file extensions only

  1. .php
  2. .php3
  3. .phtml

This files content text, HTML, Javascript, styles

By PHP with No comments

What is PHP?

PHP is the powerful open source server side scripting language.PHP means Hypertext Preprocessor. In this PHP script runs only on server side not client side.

Mostly all the databases are suitable for using PHP (MySQL, Informix, Oracle, Sybase, Solid, PostgreSQL, Generic ODBC, etc. )

Its a free to download and easy to use.

Before going to use PHP, You should know about following,

  • HTML
  • JAVASCRIPT

By PHP with No comments

Wednesday, November 17, 2010

Login Page creation using PHP/MYSQL

When you are going to create login, you should follow the following steps

Technology : PHP
Database MYSQL
Server : WAMP

1. Create the user table
CREATE TABLE `Users` ( `user_id` int(4) NOT NULL auto_increment, `username` varchar(65) NOT NULL default '', `userpassword` varchar(65) NOT NULL default '', PRIMARY KEY (`user_id`) ) TYPE=MyISAM AUTO_INCREMENT=1 ;


   Insert user login information into table

INSERT INTO users VALUES (1, 'john', '1234');


2. Create the login page like mylogin.php
<form id="form1" name="form1" method="post" action="my_login_action.php">
  <table border="0"  width="95%" cellpadding="0" align="center" cellspacing="0" >
    <!--DWLayoutTable-->
    <tr>
      <td colspan="4" height="25" align="left">&nbsp;</td>
    </tr>
    <tr>
      <td  width="68"></td>
      <td height="35" width="173" align="right" valign="middle">My e-mail address is:</td>
      <td  width="7"></td>
      <td width="441" align="left" valign="middle"><input name="login_email" type="text" id="login_email" maxlength="50" />
      </td>
    </tr>
    <tr>
      <td  ></td>
      <td height="35"  align="right" valign="middle">My password is:</td>
      <td  ></td>
      <td align="left" ><input name="login_password" type="password" id="login_password" maxlength="50" />
        </span></span></td>
    </tr>
    <tr>
      <td height="45" colspan="4" align="right" valign="middle"><label>
        <input  name="Login" src="images/log-in-button.gif"  type="image" id="Login" value="Login" />
        </label>
      </td>
    </tr>
  </table>
</form> 

3. Create the login action file as my_login_action.php
 
if($_REQUEST['Login'])
{
    extract($_REQUEST);
    
    $_check_login = "Select * from  Users where username = '$login_email' && userpassword = '$login_password'";
    $_check_login_01 =     mysql_query($_check_login) or die(mysql_error());
    if(mysql_num_rows($_check_login_01) > 0)
    {
        
            header("Location: successlogin.php");
            exit();
        
    }
    else
    {
        header("Location: failurelogin.php");
        exit();
    }
    
} 
 
4. Create the login success page as successlogin.php
        <?php
        // Check if session is registred or not. If not redirected to main page of the php
        // paste this code on the first line in the page of php 
        
        session_start();
        if(!session_is_registered(successusername)){
        header("location:main_success_login.php");
        }
        ?>
        
        <html>
        <body>
        my php page  Successfully logged in
        </body>
        </html>
        </body>
        </html>

5. Create the login failure page page as failurelogin.php


        <?php
        // if login failed, page redirected to the main login page
        // paste this code on the first line in the login page of php 
        
        session_start();
        if(!session_is_registered(successusername)){
        header("location:main_login_page.php");
        }
        ?>
        
        <html>
        <body>
        you are mentioned user name or password is wrong
        </body>
        </html>
        </body>
        </html>

6. Create the Logout page page as logoff.php
     // Paste this code on the top off the logoff.php page.
        <?php
        session_start();
        session_destroy();  

Tags: php, Mysql, php login page, php mysql page, login page, email using php login, login using php, logout pge, logoff, create database, login success, login failure, login success php, login failure,php

By PHP with No comments

    • Popular
    • Categories
    • Archives