Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Senior Member
    Join Date
    Feb 2011
    Posts
    101
    Member #
    26966
    submission code that doesn't refresh page:
    PHP Code:
    <?php
    // Query member data from the database and ready it for display
    $sql mysql_query("SELECT * FROM cart where cart_id = ".$cid."");
    while(
    $row mysql_fetch_array($sql)){
    $id =$row["id"];
    ?>
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js"></script>
        <script type="text/javascript">
        $(document).ready(function(){
            $(".update<?php echo $id?>").validate({
                debug: false,

                submitHandler: function(form) {
                    // do other stuff for a valid form
                    $.post('update.php', $(".update<?php echo $id;?>").serialize(), function(data) {
                        $("#price").load("index.php #price");$("#total").load("index.php #total");
                    });
                }
            });
        });
        </script>
        <?php
    }
    ?>
    form:
    Code:
    <?php
    // Query member data from the database and ready it for display
    $sql = mysql_query("SELECT * FROM cart where cart_id = ".$cid."");
    while($row = mysql_fetch_array($sql)){
    $product = $row["product123"];
    $price1 = $row["price"];
    $id = $row["id"];
    $qty = $row["quantity"];
    if($product !=""){
      
    ?>
    
    <form action="" class="update<?php echo $id; ?>" method="POST">
    <input name="id" type="hidden" value="<?php echo $id; ?>" />
    Quantity
    <input name="qty" type="text" value="<?php echo $qty; ?>" size="2" />$
    <input name="price" type="text" value="<?php echo $price1; ?>" size="6" />
      <input type="submit" name="update" id="update" value="update" />
    </form>
    so my problem is that only everyother time does the page actually not refresh.......so one time it does and database doesn't update......second time it doesn't refresh and it updates(this is what I want). why is it doing this? is it because it is inside a div that gets refreshed? if this is the problem....how do I fix it?

  2.  

  3. #2
    Senior Member
    Join Date
    Feb 2011
    Posts
    101
    Member #
    26966
    soes what it is doing make sense? and what I want it to do?


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 06:24 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com