Jump to content

Network_ninja

Members
  • Posts

    94
  • Joined

  • Last visited

    Never

Posts posted by Network_ninja

  1. change this line:

    $sql = 
    mysql_query("UPDATE members 
    SET name='{$_POST['name']}', age='{$_POST['age']}, mf='{$_POST['mf']}', loc='{$_POST['loc']}' 
    WHERE usr='{$_SESSION['usr']}'");

     

    TO:

    $sql = 
    mysql_query("UPDATE members 
    SET name='$_POST[name]', age='$_POST[age]', mf='$_POST[mf]', loc='$_POST[loc]' 
    WHERE usr='$_SESSION[usr]' ");

  2. The serverside scripts will need to check to make sure that time has expired everytime it is called to accept answer data.

     

    what wud be the best ideal time to check? i am thinking if it is a good idea to run a serverside scripts to every seconds to check if time already expire?

  3. Can someone show me the way? I am creating a online examination with time pressured. For example Part I of examination is only good for 20 mins. now if 20 mins is over it will be lock or good as submit. How will I do that?

     

    tnx everyone.

  4. Or it coudl be done by having the laoder etc... pre coded on the page and have the CSS display set to none and if something hasn't happened ie XMLHTPP request is still loading via your get then show the loader, not too sure how to do this in jQUERY but javascript it is easy as, and rememer you can swap it about by putting javascript in jQuery. Hope that helps if I have understood ur issue correctly

     

    this is the one I use and it's working. tnx for the reply, I was thinking that there is something like this is jquery but haven't found one.

    if(document done executing the script) { 
         display the result 
    }
    else { 
        show a preloader
    }
    

  5. Simple jquery get method:

     

    jQuery(function ($) {
    
    $('.add_cashier').click(function (e) {
    	var id = $(this).attr("id");
    
    	$('#basic-modal-content').modal();
    
    	$.get("ajax/cashier_entry.php?id="+id, function(data) {
    	$("#basic-modal-content").html(data);
    	});
    
    	return false;
    });	 
    
    });

     

    Hi that is my simple code to get data from cashier_entry.php and loads it in a div. My question is if it is still not ready to be load I want some preloader to display. Not just a blank page and waiting for the result to come out...

     

    Tnx in advance.

  6. Is there a way in php to not execute the whole script if there is error on the script?

     

    For example:

         

          <?php 
                   execute script here;
                   ..........
                   ...........
                  [b] error encounter here[/b].  -> error is not logical
                  execute script
                  .............
                  .............
          ?>
          

     

    I don't want to execute the above script... tnx everyone.

  7. Just a wild guess. Is it a registration form or adding contents? and you would like to give warning to the user that if he/she navigates away from page the data will not be save?

     

    then you can use what nogray provided. and for undesired result you could add checking if the content has a content and fire the javascript:

    I'm talking about like this:

    <html>
    <head>
    <title>Untitled Document</title>
    <script type="text/javascript">
    window.onbeforeunload = function(){
    	var txt = document.getElementById("content").value; 
    	if(txt != '') { 
    		return 'are you sure you want to leave?';
    	}
    }
    </script>
    </head>
    
    <body>
        Type content here: <input type="text" name="content" id="content">
    </body>
    </html>

     

     

    Just a suggestion and wild guess.  :shrug:

    cheers!

  8. I also encounter that kind of scenario in one of my project so what I did is the first thing that I mention to you if possible. But if the case is similar to yours I used the code I provided to you. I am not pretty much sure why it cannot call a javascript that way, so most probably that will not also work.

  9. Ok... You can try out this code if you want.

     

    frontend.php

    <!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>
    
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
    	$('.link1').click(function(){
    		var param = $(this).attr("id");
    		$.get("backend.php?param="+param, function(data) {
    			$("#result").html(data);
    		});
    	});
    });
    </script>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    
    <body>
    <?php 
    	$param = 'this is parameter'; 
    
    	echo "<a href='#' class='link1' id='$param'>Pls click me</a>";
    ?>
        
        <div id="result"></div>
    </body>
    </html>
    

     

    backend.php

    <?php 
    echo "The parameter you pass -- <b>". $_GET['param']."</b>"; 
    echo "<script>alert('success');</script>";
    ?>
    

     

    I tested out that code and it's working the way you wanted it to be.

  10. is it not possible to call the function after the script?

     

    e.g:

    <head>

    <script language='javascript'>

    function show_media_type(pub_type){

    var url = "get_media.php?media_type=" + pub_type;

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

    http.onreadystatechange = showmedia;

    http.send(null);

           

          alert('Hi');

    }

    function confirm_media(){

      if(http.readyState == 4){

        document.getElementById('header').innerHTML = http.responseText;

      alert('Hi');

    }

    }

    </script>

    </head>

×
×
  • 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.