SOLUTION 1 to 5

Slip no:-    01
Q1. Write a java program to display IP Address and Name of client machine.            [15]

Q2. Write a JSP script to accept username, store it into the session, compare it with password in another jsp file, if username matches with password then display appropriate message in html file.                                                                                                                       [25]
ANS :

Userpass.html

<html>
<body>
<form method=get action="userpass.php">
Enter UserName : <input type=text name="t1"><br><br>
Enter Password   : <input type=text name="t2"><br><br>
<input type=submit value="Log In">
</form>
</body>
</html>


userpass.php

<?php
          session_start();
          session_register("chance");
       if($_SERVER['REQUEST_METHOD']=='GET')
       {
 ?>
<form method=post action="<?php echo $_SERVER['PHP_SELF']?>">
<P>Name : <input type=text name=uname value="<?php if(isset($_POST['uname'])) echo $_POST['uname'];?>"></p>
<P>Passoword : <input type=text name=pass value="<?php if(isset($_POST['pass'])) echo $_POST['pass'];?>"></p>
<input type=submit name=submit value=submit>
</form>
<?php
  }
else if($_SERVER['REQUEST_METHOD']=='POST')
{
$name=$_POST['uname'];
$pass=$_POST['pass'];
if(($name=="ABC") && ($pass=="abc"))
echo"Hello <a href='next.php'>next form</a>";
else
echo"wrong username password ".session_register("chance")."!!!";
$chance++;
if($chance==3)
echo"sorry!!! your chance are finished!!!!!";
}
else
{
 die("not able to process script");
}
?>

Q3. Write a PHP program to create a simple calculator that can accept two numbers and perform operations like add, subtract, multiplication and divide (using Self Processing form)                                                                                                                                              [15]
ANS :
<HTML>
<BODY>
<FORM method=POST action="<?php echo $_SERVER['PHP_SELF'] ?>">
Enter   First   Value  :<INPUT type=text name=a><BR><BR>
Enter Second Value:<INPUT type=text name=b><BR><BR>
<b>Select Arithmetic Operation</b><BR><BR>
<INPUT type=radio name="choice" value="1">Addition<BR><BR>
<INPUT type=radio name="choice" value="2">Subtraction<BR><BR>
<INPUT type=radio name="choice" value="3">Multiplication<BR><BR>
<INPUT type=radio name="choice" value="4">Division<BR><BR>
<INPUT type=submit name=submit value="Calculate"><BR>
</FORM>
<?php
         $c="";
         if(isset($_POST['submit']))
         {
           $a=$_POST['a'];
           $b=$_POST['b'];
           $ch=$_POST['choice'];
          
           if($ch=='1')
           {
            $c=$a+$b;
            echo"Addition =  $c";
           }
           if($ch=='2')
           {
            $c=$a-$b;
            echo"Subtraction =  $c";
           }
           if($ch=='3')
           {
            $c=$a*$b;
            echo"Multiplication =  $c";
           }
           if($ch=='4')
           {
            $c=$a/$b;
            echo"Division =  $c";
           }
         }
?>
</BODY>
</HTML>

Q4. Write class declarations and member function definitions for following
 employee(code, name, designation). Design derived classes as
 emp_account(account_no, joining_date) from employee and
 emp_sal(basic_pay, earnings, deduction) from emp_account.
Write a PHP Script to create 5 objects (pass details using parameterized constructor)    and Display details of Employees who having Maximum and Minimum Salary.                                                                                                          [25]
ANS :

Employee.html
<html>
<body>
<form method=get action="emp.php">
Enter Employee Code : <input type=text name=ecode><br>
Enter Employee Name : <input type=text name=ename><br>
Enter Designation : <input type=text name=des><br>
<input type=submit value=Save>
</form>
</body>
</html>
       
Display.php
<?php
      $ecode=$_GET['ecode'];
      $ename=$_GET['ename'];
      $des=$_GET['des'];
    if(isset($_COOKIE['ecode'])&&isset($_COOKIE['ename'])&&isset($_COOKIE['des']))
   {
      echo"<br><b>Employee Details </b><br>";
     echo"Employee Code : ".$_COOKIE['ename']." <br>";
     echo"Employee Name:".$_COOKIE['ename']."<br>";
     echo"Designation. : ".$_COOKIE['des']."<br>";
     echo"<br><b>EMPLOYESS Details</b><br>";
     echo"Account No. : $ano<br>";
             echo"Joining Date : $jdate<br>";
             
  }
?>

Emp.php
<?php
       $ecode=$_GET['ecode'];
       $ename=$_GET['ename'];
       $designation=$_GET['des'];
       setcookie("ecode",$ecode);
       setcookie("ename",$ename);
       setcookie("des",$des);
     
 echo"Hello $ename enter your details <br><br>";
 echo"<form method=get action=display.php>
                       echo"Account No. : $ano<br>";
                         echo"Joining Date : $jdate<br>";

 echo"Hello $ename enter your salary <br><br>";
 echo"<form method=get action=display.php>
                        echo"Basic pay. : $bpay<br>";
                         echo"Earnings : $earnings<br>";
                           echo"Deduction : $deduction<br>";
                 <input type=submit value=Display>
                </form>";
 ?>
     


Slip no:-    02

Q1. Write a multithreading program in java to display all the vowels from a given String.(Use Thread Class)                                                                                                         [15]
ANS :
import java.lang.*;
import java.util.*;
class Reverse extends Thread
{
            Reverse()
            {
                        start();
            }
            public void run()
            {
                        for(int i=1;i<=10;i++)
                                    System.out.println(" "+i);
            }
}
class Vowels extends Thread
{
            String s1;
            Vowels(String s)
            {
                        s1=s;
                        start();
            }
            public void run()
            {
                        System.out.println("Vowels are  ");
                        for(int i=0;i<s1.length();i++)
                        {
                                    char ch=s1.charAt(i);
                                    if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u'||ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U')
                                                System.out.print(" "+ch);
                        }
            }
}
public class Demo1 {
  
    public Demo1() {
    }
   
    public static void main(String[] args)
    {
            Scanner sn=new Scanner(System.in);
            System.out.println("Enter a string");
            String str1=sn.next();
            Reverse r=new Reverse();
            Vowels v=new Vowels(str1);
       
    }
}

Q2. Write a SERVLET program which counts how many times a user has visited a web page. If user is visiting the page for the first time, display a welcome message. If the user is revisiting the page, display the number of times visited. (Use Cookie)                               [25]
ANS :
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class VisitServlet extends HttpServlet
{
    static int i=1;
    public void doGet(HttpServletRequest request, HttpServletResponse response)
        throws IOException, ServletException
    {
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        String k=String.valueOf(i);
        Cookie c = new Cookie("visit",k);
        response.addCookie(c);
        int j=Integer.parseInt(c.getValue());
        if(j==1)
        {
            out.println("Welcome");
        }
        else
        {
            out.println("You visited "+i+" times");
        }
                i++;                       
    }
}


Web.xml file(servlet entry)
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app>
<servlet>
        <servlet-name>VisitServlet</servlet-name>
        <servlet-class>VisitServlet</servlet-class>
    </servlet>
<servlet-mapping>
        <servlet-name>VisitServlet</servlet-name>
        <url-pattern>/servlet/VisitServlet</url-pattern>
    </servlet-mapping>
</web-app>





Q3. A college has given roll number to each student, The roll number is six digit number where first two digits are faculty(B.Sc., BCA, BA) third digit is year (Ist(1), IInd(2) and IIIrd(3)) and last three digit are actual number. Write PHP script to accept a number and print faculty, year and roll number of student.(e.g Rollno=BC1004,faculty=BCA, year=1st,rollno=004)                                                                                                                     [15]
ANS :
Stusent.html

<html>
<body>
<form method=get action="student.php">
Enter Roll No. <input type=text name="a"><br>
<input type=submit value=submit>
</form>
</body>
</html>

Student.php
<?php
$a=$_GET['a'];
if(ereg("^BC|A|S([1-3])([0-9][0-9][0-9])$",$a))
{
   echo"Roll no = ".substr($a,3)."<br>";
   $year=substr($a,2,1);
  if($year=='1')
  echo"Year = 1st <br>";
   if($year=='2')
  echo"Year = 2nd <br>";
  if($year=='3')
  echo"Year = 3rd <br>";

  $fac=substr($a,0,2);
  if($fac=='BA')
  echo"Faculty = BA";
  if($fac=='BC')
  echo"Faculty = BCA";
  if($fac=='BS')
  echo"Faculty = B.Sc.";
}
else
{
echo"Invalid Roll No.";
}
?>


Q4.      Define an interface which has methods area(), volume(). Define constant PI. Create a class cylinder which implements this interface and calculate area and volume. (Use define()                                                                                                                                 [25]
ANS :

<?php
       interface Cyl
        {
              function area();
              function volume();
        }
        class Cylinder implements Cyl
        {
           public $PI=3.14;
           public $a;
           public $r;
           public $h;
           function __construct($r,$h)
           {
                $this->r=$r;
                $this->h=$h;
           }
           function area()
           {
              $this->a=2*$this->PI*($this->h*$this->r);
              echo"Area = ".$this->a."<br>";
            }
            function volume()
           {
              $this->a=$this->PI*$this->r*$this->r*$this->h;
              echo"Volume = ".$this->a."<br>";
            }
        }
       $c=new Cylinder(5,5);
       $c->area();
       $c->volume();
?>





Slip no:-    03

Q1. Write a JDBC program to displays the details of employees (eno, ename, department, sal) whose department is “Computer Science”.                                                                   [15]
ANS :
import java.io.*;
import java.sql.*;
public class Computer Science
{
            static Connection cn;
            static Statement st;
            static PreparedStatement ps;
            static ResultSet rs;
            public static void main(String args[])
            {
                        try
                        {
                                    int eno,sal;
                                    String ename, department;
                                   
                                    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
                                    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                                    cn=DriverManager.getConnection("jdbc:odbc:dsn","","");
                                    String str="create table ComputerScience (eno number,ename varchar(20), department varcar(20)sal number)";
                                    ps=cn.prepareStatement(str);
                                    ps.executeUpdate();
                                    System.out.println("\n Computer Science Table Created");
                                    System.out.println("\n Howmany Records you want to insert?");
                                    int n=Integer.parseInt(br.readLine());
                                    System.out.println("\nEnter "+n+" Records \n");
                                    for(int i=0;i<n;i++)
                                    {
                                                System.out.println("\n ENTER EMP NO.");
                                                eno=Integer.parseInt(br.readLine());
                                                System.out.println("ENTER EMP NAME");
                                                ename=br.readLine();
                                                System.out.println("ENTER DEPARTMENT ");
                                                department =br.readLine();
                                                System.out.println("ENTER SAL ");
                                                sal=Integer.parseInt(br.readLine());
                                                ps=cn.prepareStatement("insert into ComputerScience values(?,?,?)");
                                                ps.setInt(1,eno);
                                                ps.setString(2,eame);
                                                ps.setInt (3, department);
                                                ps.setInt(4,sal);
                                                ps.executeUpdate();
                                    }
                                    System.out.println("\nAll Records are: \n");
                                    st=cn.createStatement();
                                    rs=st.executeQuery("select * from ComputerScience ");
                                    System.out.println("eno \t ename \t department \t sal.");
                                    while(rs.next())
                                    {
                                                System.out.println(rs.getInt("eno")+"\t"+rs.getString("ename")+"\t"+rs.getString ("department")+"\t"+rs.getInt(“sal”)”);          
                                    }
                                    cn.close();       
                        }catch(Exception e)
                        {
                                    System.out.println(e);
                        }
            }
}


Q2. Write a java program to simulate traffic signal using multithreading.                [25]
ANS:
import java.awt.*;
/*<applet code="signal.class" height=450 width=350>
</applet>*/
public class signal extends java.applet.Applet implements Runnable
{
    Thread t;
    int r,g1,y,i;
    public void init()
    {
            t=new Thread(this);
         t.start();
            r=0;g1=0;i=0;y=0;
           
           
    }
   
    public void run()
    {
            try{
           
    for(i=24;i>=1;i--)
     {
                                   
            if (i>16&&i<=24)
            {
                        t.sleep(200);
                        r=1;
                                    repaint();
            }
           
            if (i>8&&i<=16)
            {
                        t.sleep(200);
                        y=1;
                                    repaint();
            }
           
            if (i>1&&i<=8)
            {
                        t.sleep(200);
                        g1=1;
                                    repaint();
            }
           
     }
     if (i==0)
            {
                        run();
            }
            }catch(Exception e){
            }
           
           
    }

    public void paint(Graphics g)
    {
      g.drawRect(100,100,100,300);
        if (r==1)
            {           g.setColor(Color.red);
                                g.fillOval(100,100,100,100);
                                g.setColor(Color.black);
                                    g.drawOval(100,200,100,100);
                                                g.drawOval(100,300,100,100);
                        r=0;
            }
           
         if (y==1)
            {          
                                g.setColor(Color.black);
                                g.drawOval(100,100,100,100);
                                g.drawOval(100,300,100,100);
                                g.setColor(Color.yellow);
                                    g.fillOval(100,200,100,100);
                                               
                        y=0;
            }     
        
    if (g1==1)
            {          
                                g.setColor(Color.black);
                                g.drawOval(100,100,100,100);
                                    g.drawOval(100,200,100,100);
                                    g.setColor(Color.green);
                                                g.fillOval(100,300,100,100);
                        g1=0;
            }
   
   
    }
}



Q3. Write a PHP script to demonstrate the introspection for examining class(use function get_declared_classes() ,get_class_methods() and get_class_vars()).                                [15]
ANS :

<?php
          class Myclass
          {
           public $a;
           public $b=10;
           public $c='ABC';
            function Myclass()
            {
              //Myclass function
            }
            function myfun1()
            {
               //functin
            }
           function myfun2()
            {
               //functin
            }
          }
$class=get_declared_classes();
foreach($class as $cname)
{
   echo"$cname <br>";
}
echo"<br>Class Methods are : <br>";
 $m=get_class_methods('Myclass');
foreach($m as $mname)
{
   echo"$mname <br>";
}
$cp=get_class_vars('Myclass');
echo"class variables are :<br>";
foreach($cp as $cpname => $v)
{
   echo"$cpname : $v <br>";
}
?>

Q4. Derive a class square from class Rectangle. Create one more class circle. Create an interface with only one method called area (). Implement this interface in all the classes. Include appropriate data members and constructors in all classes. Write a program to accept details of a square, circle and rectangle and display the area.
                                                                                                                                                [25]
ANS :

<?php
    interface Area
    {
            function area();
    }
    class Rectangle implements Area
    {
        public $w;
        public $l;
        function __construct($w,$l)
        {
                        $this->w=$w;
                        $this->l=$l;
                       
        }
            function area()
        {
         return($this->w*$this->l);
        }
    }
    class Square extends Rectangle implements Area
    {
            public $l;
        function __construct($l)
        {
            parent::__construct(12,3);
            echo "<br>Area of Rectangle : ".parent::area()."<br>";
            $this->l=$l;
        }
            function area()
        {
         return($this->l*$this->l);
        }
    }
    class Circle implements Area
    {
        public $PI=3.14;
            public $r;
        function __construct($r)
        {
            $this->r=$r;
        }
            function area()
        {
         return($this->PI*$this->r*$this->r);
        }
    }
    $sq=new Square(4);
    echo "Area of Square : ".$sq->area();
    $cr=new Circle(5);
    echo "<br>Area of Circle : ".$cr->area();
   
?>







Slip no:-    04

Q1. Write a java program to display “Hello Java” message n times on the screen. (Use Runnable Interface).                                                                                                              [15]
ANS :
class Hellojava implements Runnable
{
            Thread t;
            public Hellojava(String title)
            {
                        t=new Thread(this,title);
                        t.start();
            }
            public void run()
            {
                        for(int i=0;i<20;i++)
                        {
                                    System.out.println((i+1)+"ThreadName:"+Thread.currentThread().getName());
                                    try
                                    {
                                                Thread.sleep(100);
                                    }
                                    catch(Exception e)
                                    {
                                    }
                                    }
                        }
            }
            public class Hellojava
            {
                        public static void main(String a[])
                        {
                                    System.out.println("ThreadName:"+Thread.currentThread().getName());
                                    Hellojava hj=new Hellojava("HELLO JAVA");
                        }
            }

Q2. Write a JSP program to create an online shopping mall. User must be allowed to do purchase from two pages. Each page should have a page total. The third page should display a bill, which consists of a page total of whatever the purchase has been done and print the total.       (Use Session)
                                                                                                                                                [25]


Q3. Write a Calculator class that can accept two values, then add them, subtract them, multiply them together, or divide them on request. For example:
$calc = new Calculator( 3, 4 );
echo $calc- >add(); // Displays “7”
echo $calc- >multiply(); // Displays “12”                                                                 [15]
 ANS :

Calulate.html
<HTML>
<BODY>
<FORM method=get action="Calulate.php">
Enter first value: <INPUT type=text name="a"><br>
Enter second value:<INPUT type=text name="b"><br>
<INPUT type=submit>
</FORM>
</BODY>
</HTML>

Calulate.php
<?php
      class Calculate
      {
        public $a;
        public $b;
      
        function __construct($a,$b)
        {
          $this->a=$a;
          $this->b=$b;
         }
         public function add()
         {
          $c=$this->a+$this->b;
          echo"Addition = $c<br>";
         }
         public function subtract()
         {
          $c=$this->a-$this->b;
          echo"Subtract = $c<br>";
         }
         public function multiply()
         {
          $c=$this->a*$this->b;
          echo"Multiplication = $c<br>";
         }
         public function div()
         {
          $c=$this->a/$this->b;
          echo"Division = $c";
         }
    }
$x=$_GET['a'];
$y=$_GET['b'];
$calc=new Calculate($x,$y);
$calc->add();
$calc->subtract();
$calc->multiply();
$calc->div();
?>


Q4.  Create a login form with a username and password. Once the user logs in, the second form should be displayed to accept user details (name, city, phoneno). If the user doesn’t enter information within a specified time limit, expire his session and give a warning otherwise Display Details($_SESSION).                                                                                [25]
ANS :

LoginSession.html
<html>
<body>
<form method=get action=details.php>
user name : <input type=text name=uname><br><br>
password : <input type=text name=pass><br><br>
<input type=submit value=Login>
</form>
</body>
</html>

Details.php
<?php
        session_start();
        if(set_time_limit(20))
      echo"time expired";
    if(($_REQUEST['uname']=='ABC') && ($_REQUEST['pass']=='abc'))
    {
        echo"<form method=post action='display.php'>";
        echo"Name : <input type=text name=name><br>";
        echo"city   : <input type=text name=city><br>";
        echo"PhoneNo.:<input type=text name=pno><br>";
        echo"<input type=submit value='Display'></form>";
    }
  else
   echo"Wrong Information...<a href=LoginSession.html>LoginSession.html</a>";
?>




Slip no:-    05

Q1. Write a java program to create Teacher table(TNo.TName, Sal, Desg) and insert a record in it.                                                                                                                           [15]
ANS :
import java.io.*;
import java.sql.*;
public class CreateTeacherTable
{
            static Connection cn;
            static Statement st;
           
            public static void main(String args[])
            {
                        try
                        {
                                    int tno,sal;
                                    String tname,desg;
                                    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
                                    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                                    cn=DriverManager.getConnection("jdbc:odbc:dsn","","");
                                    st=cn.createStatement();
                                    String str="create table Teacher(TNo number,TName varchar(20),Sal number,Desg varchar(20))";
                                    st.executeUpdate(str);
                                    System.out.println("Table Created");
                                    System.out.println("Enter Tno");
                                    tno=Integer.parseInt(br.readLine());
                                    System.out.println("Enter Tname");
                                    tname=br.readLine();
                                    System.out.println("Enter Sal");
                                    sal=Integer.parseInt(br.readLine());
                                    System.out.println("Enter Desg");
                                    desg=br.readLine();
                                    st.executeUpdate("insert into Teacher values("+tno+",'"+tname+"',"+sal+",'"+desg+"')");
                                    System.out.println("Record added successfully");
                                    cn.close();       
                        }catch(Exception e)
                        {
                                    System.out.println(e);
                        }
            }
}
Q2.  Write a MultiThreading program in java using Runnable interface to draw temple flag on an applet container.                                                                                                         [25]
ANS :
import java.awt.*;
import java.applet.*;
/*
<APPLET
            code    = "Flag.class"
            width   = "500"
            height  = "300"
            >
</APPLET>
*/
public class Flag extends Applet implements Runnable
{
            Thread t;
            int x1,x2,x3,y3,x4,y4,x5,ln;
           
            public void init()
            {
                        t=new Thread(this);
                        t.start();
                        ln=1;
            }
            public void run()
            {
            try
            {          if(ln==1)
                        {
                                    for(x1=200;x1>100;)
                                    {
                                                t.sleep(200);
                                                repaint();
                                    }
                        }
                        ln=2;
                        if(ln==2)
                        {
                                    for(x2=100;x2<150;)
                                    {
                                                t.sleep(200);
                                                repaint();
                                    }
                        }
                        ln=3;
                        if(ln==3)
                        {
                                    for(x3=150,y3=100;x3>125&&y3<125;)
                                    {
                                                t.sleep(200);
                                                repaint();
                                    }
                        }
                        ln=4;
                        if(ln==4)
                        {
                                    for(x4=125,y4=125;x4<150&&y4<150;)
                                    {
                                                t.sleep(200);
                                                repaint();
                                    }
                        }
                        ln=5;
                        if(ln==5)
                        {
                                    for(x5=150;x5>100;)
                                    {
                                                t.sleep(200);
                                                repaint();
                                    }
                        }
                        ln=1;
            }catch(Exception e)
                        {
                                    System.out.println(e);
                        }
            run();  
            }
            public void paint(Graphics g)
            {
                        if(ln==1&&x1>100)
                        {
                                    g.drawLine(100,200,100,x1-=5);
                        }
                       
                        if(ln==2&&x2<150)
                        {
                                    g.drawLine(100,200,100,100);
                                    g.drawLine(100,100,x2+=5,100);
                        }
                        if(ln==3&&x3>125&&y3<125)
                        {
                                    g.drawLine(100,200,100,100);
                                    g.drawLine(100,100,150,100);
                                    g.drawLine(150,100,x3-=5,y3+=5);
                        }
                        if(ln==4&&x4<150&&y4<150)
                        {
                                    g.drawLine(100,200,100,100);
                                    g.drawLine(100,100,150,100);
                                    g.drawLine(150,100,125,125);
                                    g.drawLine(125,125,x4+=5,y4+=5);
                        }
                        if(ln==5&&x5>100)
                        {
                                    g.drawLine(100,200,100,100);
                                    g.drawLine(100,100,150,100);
                                    g.drawLine(150,100,125,125);
                                    g.drawLine(125,125,150,150);
                                    g.drawLine(150,150,x5-=5,150);
                        }
                       
            }
}

Q3. Write an PHP script to search customer name from customer.dat file(Use AJAX concept)                                                                                                                                  [15]
ANS :
Search.php
<?php
function searchcustomerName(Array $array,$value)
{
    $firstresult ="";
      foreach ($array as $subarray)
           {
              if(isset($subarray[1])&& stristr($subarray[1],$value)&&$ value!="")
                 {
                        $firstresult .= $subarray[0]." ".$subarray[1]."".$subarray[2]."<br/>";
             }
            }
         return $firstresult;
   }
        $file= fopen("Customer.dat", "r");
        $filestring =" ";
              while(!feof($file))
                 {
                       $tempstring = fgets($file);
                       $filestring.=$tempstring."<br />";
                       $line_of_text.=$tempstring;
                 }
                       $customer = explode("\n",$line_of_text);
                       fclose($file);
                       foreach ($customer as $key =>$value)
                 {
                       $customer[$key] =explode(",",$value);
                 }
                         $term=strip_tags(substr(_POST['search_term'],0,100));
                         $string = ' ' ;
                         if($term !=" "&& $term != " ")
                {
                         $string.=searchcustomerName($customer,$term);
                 }
                         if ($string ! =" ")
                     echo $string;
                         else
                         echo'<div class="alter_yellow">No results found</div>';
   ?>

index.php

<?php
if(isset($_POST['field']))
$selectedoption =$_POST['field'];
else
$selectedoption = "customername";
?>
<head>
<script type="text/javascript"src="jquery.js">
</script>
<script type='text/javascript'>
$(document).ready(function()
{
     $("#search_result").slideUP();
     $("#search_button").click(function(e)
   {
     e.preventDefault();
     ajax_search();
    });
});
function ajax_search()
{
    $"#search_results.show();
    var search_val=$("#search_term").val();
    var.post("./search.php",{search_term : search_val, field : search_type},function(data)
      {
         if(data.length>0)
         {
              $("#search_results").html(data);
          }
      })
   }
</script>
<meta http-equiv=Content-Type" content="text/html;charset=UTF-8"/>
  <link href="style.css"media="all"rel="stylesheet" title="www"type="text/css"/>
</head>
<body>
<div id="wrapper">
   <form name="search"id=searchform" method="post">
   <div>
     Search for:<input type="text"name"search_term" id="search_term"/>in
       <Select NAME="field"id="searchtype">
       <Option <?php if ($selectedoption=='customername')echo'selected'?>VALUE="customername">customer Name</option>
</Select>
<input type="hidden"name="searching" value="yes" />
<input type="submit"id=search_button"name="search" value="search" />
</div>
</form>
<br />
<hr />
<div id="search_result"></div>
<br />
</div>
</body>
</html>





No comments:

Ebook

Ebook
Ebook