Jump to content

cool_techie

Members
  • Posts

    29
  • Joined

  • Last visited

    Never

Posts posted by cool_techie

  1. .topdiv {

    box-shadow:0px 8px 8px  #000000;//choose pixels according 2 ur wish

    -moz-box-shadow:0px 8px 8px  #000000;

    -webkit-box-shadow:0px 8px 8px  #000000;

    -o-box-shadow:0px 8px 8px  #000000;

    }

    where topdiv is the class name of a div.

    u can also create other effects using .topdiv:hover in place  of  .topdiv

  2. guys i m using chrome 11.0.696.71 doc type

     

    <!DOCTYPE html PUBtdC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

     

     

     

     

     

    <html xmlns="http://www.w3.org/1999/xhtml">

     

     

     

     

    and the code

     

    .nit {

    position:absolute;

    left:70px;

    top:30px;

    height:30px;

    width:230px;

    color:#ffffff;

    text-shadow:0px 1px 1px #000000;

    -ms-text-shadow:0px 1px 1px #000000;

    letter-spacing:1px;

    font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;

    transition: width 2s;

    -moz-transition: width 2s;

    -webkit-transition: width 2s;

    -o-transition: width 2s;

    }

            where nit is class name of a div ..

    this code is not working at all.

    sos

  3. I have a php script wihich updates data in mysql db named 'trial' and table named 'tab'

    I am using jquery and ajax to update the db. but the script is not working.

     

    edit-profile.php

    
    <?php
    session_start();
    $img=$_SESSION['img'];
    ?>
    <html>
    <head>
    <title>Tgmc</title>
    
    
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <link href="default.css" rel="stylesheet" type="text/css" media="screen" />
    <script type="text/javascript" src="jquery-1.5.min.js">
    </script>
    <script type="text/javascript">
      $(function(){
          $('#submit').click(function(){
         $('#load').append('<img src="ajax-loader.gif" id="loading" alt="image" />');
         var about= $('#about').val();
    	 var contact= $('#contact').val();
    	 var present= $('#present').val();
    	 var inter= $('#inter').val();
    	 var high= $('#high').val();
    	 var books= $('#books').val();
    	 var sports= $('#sports').val();
    	 var pastime= $('#pastime').val();
    	 var interest= $('#interest').val();
    	 console.log (about);
    
      $.ajax({
            url:'update-profile.php',
    		type:'POST',
    		data: 'contact=' + contact + '&about=' + about + '&present=' + present + '&inter=' + inter + '&high=' + high + '&books=' + books + '&sports=' + sports + '&pastime=' + pastime + '&interest=' +interest,
    		success: function(result){
    		    $('#response').remove();
    		    $('#load').append('<p id="response">' + result + '</p>');
    		    $('#loading').fadeOut(500,function(){
    		    $(this).remove();
    		      });
    	        }
        
    	});
    	return false;
      
      });
       
       });
      
    </script>
    
    </head>
    <body>
    <!-- start header -->
    <div id="wrapper">
    <div id="header">
    <div id="logo">
    	<h1><a href="#">ABC</a></h1>
    	<p><a href="#">cinemas</a></p>
    </div>
            
    <?php
    {
    if(isset($_SESSION['name'])){
    echo "<p id=\"welcome\">";
    echo "Welcome ".$_SESSION['name'];
    echo "                 ";
    echo "<a href=\"logout.php\">";
    echo "Logout";
    echo "</a>";
    echo "</p>";
    }
    }?>
    
    
    
    </div>
    </div>
    <!-- end header -->
    <!-- star menu -->
    <div id="menu">
    <ul>
    	<li class="current_page_item">
    	 <?php
               {
                if(isset($_SESSION['name'])){
    		echo "<a href=\"index1.php\">Home</a></li>";
    		}
    		else{
    		echo "<a href=\"index.html\">Home</a></li>";}}
    		?>
    	<li><a href="shows.php">Shows</a></li>
    	<li><a href="umovies.php">Upcoming Movies</a></li>
    	<li><a href="#">Reviews</a></li>
                    <li><a href="#">Book Tickets</a></li>
    	<li><a href="contact.html">Contact</a></li>
    </ul>
    </div>
    <!-- end menu -->
    <!-- start page -->
    <div id="page">
    <!-- start ads -->
    
    <!-- end ads -->
    <!-- start content -->
    <div id="content">
    	<div class="post">
    		<div class="title">
    
    			<h2>My Profile            <a href="edit-profile.php">Edit Profile</h2></a>
    		</div>
    		<div class="entry">
    		<form action="update-profile.php" method="post">
    
    
    			<p style="color:white"><a href="upload.php">Change photo</a><br/>
    
                <img src=<?php echo $_SESSION['img'] ?> width='120px' height='140px' class='left' alt='image' />
    		 <strong>Contact:-</strong><input type="text" name="contact" id="contact" value="<?php echo $_SESSION['contact']; ?>" /><br/>
    		 About:-<textarea  name="about" id="about" rows="5" cols="38" ><?php echo $_SESSION['about']; ?> </textarea><br/>
    		</p>
    
    		</div>
    
    
                <p style="color:white">Education:<br/>
                   <strong>Present:-</strong>      <input type="text" id="present" name="present" size="25" value="<?php echo $_SESSION['present']; ?>" /> <br/>
                   <strong>Inter:-          </strong><input type="text" id="inter" name="inter" size="25"value="<?php echo $_SESSION['inter']; ?>" /><br/>
                    <strong>High School:-</strong><input type="text" id="high" name="high" size="25" value="<?php echo $_SESSION['high']; ?>" /><br/>
                    <br><br>
                     <strong>Favourite Books:-</strong><input type="text" id="books" name="books" size="30" value="<?php echo $_SESSION['books']; ?>" /><br/>
                     <strong>Favourite Sport:-</strong><input type="text" id="sports" name="sports" size="30" value="<?php echo $_SESSION['sports']; ?>" /><br/>
                     <br/><br/>
                     <strong>Pastimes:-</strong><input type="text" name="pastime" id="pastime" size="25" value="<?php echo $_SESSION['pastime']; ?>" /><br/>
                     <strong>Interests:-</strong><input type="text" name="interest" id="interest" size="25" value="<?php echo $_SESSION['interests']; ?>" /><br/><br/>
    			 <input type="submit" id="submit" value="Update" />
    			 <div id="load></div>
    			 </form>
    
    
    
    	</div>
    
    
    <!-- end page -->
    <!-- start footer -->
    <div id="footer">
    <p class="legal">
    	©2010ABC Cinemas. All Rights Reserved.
    	  •  
    	Design by <a href="#/">Pulkit</a>
    	    
    	 </p>
    <p class="links">
    	<a href="http://validator.w3.org/check/referer" class="xhtml" title="This page validates as XHTML">Valid <abbr title="eXtensible HyperText Markup Language">XHTML</abbr></a>
    	 • 
    	<a href="http://jigsaw.w3.org/css-validator/check/referer" class="css" title="This page validates as CSS">Valid <abbr title="Cascading Style Sheets">CSS</abbr></a>
    </p>
    </div>
    </div>
    <!-- end footer -->
    </body>
    </html>
    

     

    update-profile.php

    
    <?php
    session_start();
    $connection=mysql_connect("localhost","root","");
    mysql_select_db("TRIAL",$connection);
    
    if(mysql_query("UPDATE tab SET about='$_POST[about]',contact='$_POST[contact]',present='$_POST[present]',inter='$_POST[inter]',high='$_POST[high]',books='$_POST[books]',sports='$_POST[sports]',pastime='$_POST[pastime]',interests='$_POST[interest]' WHERE name='$_SESSION[name]'")){
      echo "Successfully uploaded the data.<a href='index.php'>Click here</a> to return back.";
      }
      else
      echo "Unable to upload";
      ?>
    

  4. I have a php script wihich updates data in mysql db named 'trial' and table named 'tab'

    I am using jquery and ajax to update the db. but the script is not working.

     

    edit-profile.php

    <code>

     

    <?php

    session_start();

    $img=$_SESSION['img'];

    ?>

    <html>

    <head>

    <title>Tgmc</title>

     

     

    <meta http-equiv="content-type" content="text/html; charset=utf-8" />

    <meta name="keywords" content="" />

    <meta name="description" content="" />

    <link href="default.css" rel="stylesheet" type="text/css" media="screen" />

    <script type="text/javascript" src="jquery-1.5.min.js">

    </script>

    <script type="text/javascript">

      $(function(){

          $('#submit').click(function(){

        $('#load').append('<img src="ajax-loader.gif" id="loading" alt="image" />');

        var about= $('#about').val();

    var contact= $('#contact').val();

    var present= $('#present').val();

    var inter= $('#inter').val();

    var high= $('#high').val();

    var books= $('#books').val();

    var sports= $('#sports').val();

    var pastime= $('#pastime').val();

    var interest= $('#interest').val();

    console.log (about);

     

      $.ajax({

            url:'update-profile.php',

    type:'POST',

    data: 'contact=' + contact + '&about=' + about + '&present=' + present + '&inter=' + inter + '&high=' + high + '&books=' + books + '&sports=' + sports + '&pastime=' + pastime + '&interest=' +interest,

    success: function(result){

        $('#response').remove();

        $('#load').append('<p id="response">' + result + '</p>');

        $('#loading').fadeOut(500,function(){

        $(this).remove();

          });

            }

       

    });

    return false;

     

      });

     

      });

     

    </script>

     

    </head>

    <body>

    <!-- start header -->

    <div id="wrapper">

    <div id="header">

    <div id="logo">

    <h1><a href="#">ABC</a></h1>

    <p><a href="#">cinemas</a></p>

    </div>

           

    <?php

    {

    if(isset($_SESSION['name'])){

    echo "<p id=\"welcome\">";

    echo "Welcome ".$_SESSION['name'];

    echo "                 ";

    echo "<a href=\"logout.php\">";

    echo "Logout";

    echo "</a>";

    echo "</p>";

    }

    }?>

     

     

     

    </div>

    </div>

    <!-- end header -->

    <!-- star menu -->

    <div id="menu">

    <ul>

    <li class="current_page_item">

    <?php

              {

                if(isset($_SESSION['name'])){

    echo "<a href=\"index1.php\">Home</a></li>";

    }

    else{

    echo "<a href=\"index.html\">Home</a></li>";}}

    ?>

    <li><a href="shows.php">Shows</a></li>

    <li><a href="umovies.php">Upcoming Movies</a></li>

    <li><a href="#">Reviews</a></li>

                    <li><a href="#">Book Tickets</a></li>

    <li><a href="contact.html">Contact</a></li>

    </ul>

    </div>

    <!-- end menu -->

    <!-- start page -->

    <div id="page">

    <!-- start ads -->

     

    <!-- end ads -->

    <!-- start content -->

    <div id="content">

    <div class="post">

    <div class="title">

     

    <h2>My Profile            <a href="edit-profile.php">Edit Profile</h2></a>

    </div>

    <div class="entry">

    <form action="update-profile.php" method="post">

     

     

    <p style="color:white"><a href="upload.php">Change photo</a><br/>

     

                <img src=<?php echo $_SESSION['img'] ?> width='120px' height='140px' class='left' alt='image' />

    <strong>Contact:-</strong><input type="text" name="contact" id="contact" value="<?php echo $_SESSION['contact']; ?>" /><br/>

    About:-<textarea  name="about" id="about" rows="5" cols="38" ><?php echo $_SESSION['about']; ?> </textarea><br/>

    </p>

     

    </div>

     

     

                <p style="color:white">Education:<br/>

                  <strong>Present:-</strong>      <input type="text" id="present" name="present" size="25" value="<?php echo $_SESSION['present']; ?>" /> <br/>

                  <strong>Inter:-          </strong><input type="text" id="inter" name="inter" size="25"value="<?php echo $_SESSION['inter']; ?>" /><br/>

                    <strong>High School:-</strong><input type="text" id="high" name="high" size="25" value="<?php echo $_SESSION['high']; ?>" /><br/>

                    <br><br>

                    <strong>Favourite Books:-</strong><input type="text" id="books" name="books" size="30" value="<?php echo $_SESSION['books']; ?>" /><br/>

                    <strong>Favourite Sport:-</strong><input type="text" id="sports" name="sports" size="30" value="<?php echo $_SESSION['sports']; ?>" /><br/>

                    <br/><br/>

                    <strong>Pastimes:-</strong><input type="text" name="pastime" id="pastime" size="25" value="<?php echo $_SESSION['pastime']; ?>" /><br/>

                    <strong>Interests:-</strong><input type="text" name="interest" id="interest" size="25" value="<?php echo $_SESSION['interests']; ?>" /><br/><br/>

    <input type="submit" id="submit" value="Update" />

    <div id="load></div>

    </form>

     

     

     

    </div>

     

     

    <!-- end page -->

    <!-- start footer -->

    <div id="footer">

    <p class="legal">

    ©2010ABC Cinemas. All Rights Reserved.

      •  

    Design by <a href="#/">Pulkit</a>

        

    </p>

    <p class="links">

    <a href="http://validator.w3.org/check/referer" class="xhtml" title="This page validates as XHTML">Valid <abbr title="eXtensible HyperText Markup Language">XHTML</abbr></a>

     • 

    <a href="http://jigsaw.w3.org/css-validator/check/referer" class="css" title="This page validates as CSS">Valid <abbr title="Cascading Style Sheets">CSS</abbr></a>

    </p>

    </div>

    </div>

    <!-- end footer -->

    </body>

    </html>

    </code>

     

    update-profile.php

    <code>

     

    <?php

    session_start();

    $connection=mysql_connect("localhost","root","");

    mysql_select_db("TRIAL",$connection);

     

    if(mysql_query("UPDATE tab SET about='$_POST[about]',contact='$_POST[contact]',present='$_POST[present]',inter='$_POST[inter]',high='$_POST[high]',books='$_POST[books]',sports='$_POST[sports]',pastime='$_POST[pastime]',interests='$_POST[interest]' WHERE name='$_SESSION[name]'")){

      echo "Successfully uploaded the data.<a href='index.php'>Click here</a> to return back.";

      }

      else

      echo "Unable to upload";

      ?>

    </code>

     

     

  5. I have a login script which is showing problem.

    The problem is that when my username and password are correct it directs to index.php page and displays the correct username there.

    But if the password is wrong it still directs to the same page instead of different(err-login.php) page,but this time no username is displayed.

     

    index.php:

    the password verifying code is as follows(the whole code of index.php is not mentioned since it is too long and a bit messy)

    <code>

     

    <?php

    $connection=mysql_connect("localhost","root","");

    mysql_select_db("forum",$connection);

    $select=mysql_query("SELECT * FROM user_id WHERE uname='$_REQUEST[uname]'",$connection);

    $row=mysql_fetch_array($select);

    if($row['password']==$_REQUEST['password']){

    session_start();

    $_SESSION['name']=$_REQUEST['uname'];

    }

    else{

    header("Location:err-login.php");

    }

    ?>

    </code>

     

    NOTE:-The name of my db and table are correct.

    I have referred to username as uname.

  6. When i use

    mysql_error($conns);

     

    the output is:

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'add,phone) VALUES ('pulkit',pulkit@gmail.com','26','3','1991','lucknow','9000463' at line 1

     

    I am still unable to find out the error.

    NOTE:-All my table entries are VARCHAR

  7. Hello....I am using ajax,jquery with php to insert data in db.....but the script is not working.

     

    form.html:

    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <style type="text/css">
    label{
    display:block;
    }
    </style>
    <script type="text/javascript" src="jquery-1.5.min.js">
    </script>
    <script type="text/javascript">
    $(function()
    {
       $('#submit').click(function(){
       $('#container').append('<img src="ajax-loader.gif" id="loading" alt="image" />');
       
       var name=$('#name').val();
       var email=$('#email').val();
       var d=$('#d').val();
       var m=$('#m').val();
       var y=$('#y').val();
       var add=$('#add').val();
       var phone=$('#phone').val();
       $.ajax({
          url: 'process.php',
          type: 'POST',
          data: 'name=' + name + '&email=' + email + '&d=' + d + '&m=' + m + '&y=' + y + '&add=' + add + '&phone=' + phone,
          success: function(result){
             $('#response').remove();
             $('#container').append('<p id="response">' + result + '</p>');
             $('#loading').fadeOut(500,function(){
             $(this).remove();
             });
          }
          });
          return false;
       
          
       });
          
       
    });
    
    </script>
    
    </head>
    
    <body>
    <h2>User Registeration</h2>
    <form action="process.php" method="POST">
        <div id="container">
    
         Name:<br>
       <input type="text" name="name" id="name" /><br>
       Email:<br>
       <input type="text" name="email" id="email" /><br>
       Date Of Birth:<br>
       <input type="text" id="d" name="d" size="2" />
       <input type="text" id="m" name="m" size="2" />
       <input type="text" id="y" name="y" size="4" /><br>
       Address:<br>
       <input type="text" id="add" name="add" /><br>
       Phone:<br>
       <input type="text" id="phone" name="phone" /><br>
       
       <input type="submit" name="submit" id="submit" value="GO!" />
       </div>
    </form>
    
    </body>
    </html>
    

     

    process.php

    My db id named "jquery" and table is "tab"

     

    
    <?php
    $conns=mysql_connect("localhost","root","");
    if(!$conns)
    echo "error in connection";
    mysql_select_db("jquery", $conns);
    
    $name=$_POST['name'];
    $email=$_POST['email'];
    $m=$_POST['m'];
    $d=$_POST['d'];
    $y=$_POST['y'];
    $add=$_POST['add'];
    $phone=$_POST['phone'];
    
    
    echo $name,"<br>";
    echo $email,"<br>";
    echo $m, "<br>";
    echo $d,"<br>";
    echo $y,"<br>";
    echo $add, "<br>";
    echo $phone,"<br>";
    
    $query="INSERT INTO tab (name,email,d,m,y,add,phone) VALUES ('$name',$email','$d','$m','$y','$add','$phone')";
    if(!mysql_query($query,$conns))
    echo "Error";
    else
    echo "DATA inserted";
    ?>
    

     

    The output shown is:

    pulkit

    pulkit@gmail.com

    1

    26

    1991

    lucknow

    987576787

    Error

     

     

    For some values i entered.

  8. I dont know whether the statement is correct.....i just tried it.....and it didn't work.

     

    $stmt->bind_param('ssiiiss',$_POST['name'],$_POST['email'],$_POST['d'],$_POST['m'],$_POST['y'],$_POST['add'],$_POST['phone']);

     

    here my first two values are strings and next 2 tiny int's next is int and last 2 again strings.

  9. my script is not working.I wanted to insert data from a form to db

    using ajax and jquery...showing a loading icon as data is passed.

    It shows that data inserted but does not insert.

     

     

    form.html

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js">
    </script>
    <script type="text/javascript">
    $(function()
    {
    $('#submit').click(function(){
    $('#container').append('<img src="ajax-loader.gif" id="loading" />');
    
    var name=$('#name').val();
    var email=$('#email').val();
    var comments=$('#comments').val();
    
    $.ajax({
    	url: 'process.php',
    	type: 'POST',
    	data: 'name=' + name + '&email=' + email + '&comments=' + comments,
    	success: function(result){
    		$('#response').remove();
    		$('#container').append('<p id="response">' + result + '</p>');
    		$('#loading').fadeOut(500);
    	}
    	});
    
    
    });
    
    
    });
    
    </script>
    </head>
    
    <body>
    <form action="process.php" method="post">
        <div id="container">
    
    Name:<br />
    <input type="text" name="name" id="name" /><br>
    Email:<br />
    <input type="text" name="email" id="email" /><br>
    Comments:<br>
    <textarea rows="5" cols="30" name="comments" id="comments">
    </textarea><br>
    <input type="submit" name="submit" id="submit" value="GO!" />
    </div>
    </form>
    
    </body>
    </html>
    

    process.php:

    <?php
    $conns=new mysqli('localhost','root','','jquery_ex');
    $query="INSERT into tab1 (name, email, comments) VALUES (?,?,?)";
    $stmt=$conns->stmt_init();
    if($stmt->prepare($query)){
    $stmt->bind_param('sss','$_POST[name]','$_POST[email]','$_POST[comments]');
    $stmt->execute();
    }
    
    if($stmt){
    echo "Successfully inserted the data";
    }else{
    echo "Error";
    }
    ?>
    

  10. I am unable to upload image to db,

    I get a message "No image selected/uploaded"  after every trial,

     

    My HTML form is:

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    <body>
    <form enctype="multipart/form-data" action="insert.php" method="post">
    <input name="image" accept="image/jpeg" type="file">
    <input value="Submit" type="submit">
    </form>
    </body>
    </html>
    
    and my php script "insert.php" is-
    
    <?php
    // Create MySQL login values and 
    // set them to your login information.
    $username = "root";
    $password = "";
    $host = "localhost";
    $database = "test";
    
    // Make the connect to MySQL or die
    // and display an error.
    $link = mysql_connect($host, $username, $password);
    if (!$link) {
        die('Could not connect: ' . mysql_error());
    }
    
    // Select your database
    mysql_select_db ($database); 
    
    // Make sure the user actually 
    // selected and uploaded a file
    if (isset($_FILES['image']) && $_FILES['image']['size'] > 0) { 
    
          // Temporary file name stored on the server
          $tmpName  = $_FILES['image']['tmp_name'];  
           
          // Read the file 
          $fp      = fopen($tmpName, 'r');
          $data = fread($fp, filesize($tmpName));
          $data = addslashes($data);
          fclose($fp);
          
    
          // Create the query and insert
          // into our database.
          $query = "INSERT INTO tbl_images ";
          $query .= "(image) VALUES ('$data')";
          $results = mysql_query($query, $link);
          
          // Print results
          print "Thank you, your file has been uploaded.";
          
    }else{
       print "No image selected/uploaded";
    }
    
    // Close our MySQL Link
    mysql_close($link);
    ?>  
    
    
    

    my table consists if an "id" and an "image" of type "blob".

     

     

  11. Can't understand what "TYPE=MyISAM AUTO_INCREMENT=1 ;"  means in this code:

     

    CREATE TABLE `web_members` (

    `id` int(4) NOT NULL auto_increment,

    `name` varchar(65) NOT NULL default '',

    `lastname` varchar(65) NOT NULL default '',

    `email` varchar(65) NOT NULL default '',

    PRIMARY KEY (`id`)

    ) TYPE=MyISAM AUTO_INCREMENT=1 ;

  12. @doddsey_65

     

    Sorry for the messy code....

    It was because my friend handles all the html+css and I handle the php..So i did not try to make any efforts there...!

     

    I have some problems here:

    like what is the difference b/w $row['name'] and '$row[name]' 

    ...??

    I always had trouble in this quoting stuff..

  13. Somehow I was able to manage the problem.

    What i did was that my earlier script was:

     

    <h2><?php

            {

    if(isset($_SESSION['name']))

    echo "Welcome ".$_SESSION['name'];

    }

    ?></h2>

     

     

    I only removed that h2 element and inserted in echo like this:

    if(isset($_SESSION['name']))

    echo "<h2>Welcome ".$_SESSION['name'],"</h2>";

     

    And now it is working fine..!

  14. Hello sir,

              I am working on ajax..and i m new to it....so my script is not working properly.......my ajax script is as under:

     

     

    <html>

    <head>

    <title>Using ajax</title>

    <script language="javascript" type="text/javascript">

      var request = false;

      try {

        request = new XMLHttpRequest();alert("object created");

      } catch (trymicrosoft) {

        try {

          request = new ActiveXObject("Msxml2.XMLHTTP");

        } catch (othermicrosoft) {

          try {

            request = new ActiveXObject("Microsoft.XMLHTTP");

          } catch (failed) {

            request = false;

          } 

        }

      }

     

      if (!request)

        alert("Error initializing XMLHttpRequest!");

     

      function process() {

        var name = document.getElementById("name").value;

    var password=document.getElementById("passwd").value;

    alert(name);

        var url = "process-form.php?name=" + escape(name);

      request.open("GET", url, true);

        request.onreadystatechange = updatePage;

        request.send(null);

      }

     

      function updatePage() {

       

        alert("Server is done!");

      }

    </script>

    </head>

    <body>

    <h2><p align="center">Please fill the form</p></h2>

    <form align="center" method="GET">

    Name: 

    <input type="text" name="name" onChange="process();"/><br/>

    Password:

    <input type="password" name="passwd"/><br/>

     

    </form>

    </body>

    </html>

     

    and my php script is:

     

     

    <html>

    <head><title>form</title>

    </head>

    <body>

    <?php

    $connection=mysql_connect("localhost","root","");

    if(!$connection)

    {

    die('unable to connect '.mysql_error());

    }

    echo"$name<br/>";

    ?>

    </body>

    </html>

     

     

    only it is popping an alert box.....that says "object created"

     

     

    then after pressing enter...it again shows the form

    pls help me out here..

  15. yes sir,i am using it on xampp via http://localhost

    and my form is on index.html.....which uses php script login.php

    now when i tried header("location:index1.html")

    there was no effect............the redirected page is blank.....and in address bar contains address of login.php

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.