Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Aug 2010
    Posts
    712
    Thanks
    165
    Thanked 0 Times in 0 Posts

    Need help in condition that if data save header location

    Hi..

    I have query for insert then I just want to add condition that after it save it will locate on the previous page:

    here is my code:

    Code:
    $sql = "INSERT INTO receiving_materials
        (sr_date, sr_number, si_num, s_name, po_num, qty, mat_code, mat_desc, wh_code, bin_loc)
        VALUES
        ('$sr_date', '$sr_number', '$si_num', '$s_name', '$po_num', '$qty', '$mat_code', '$mat_desc', '$wh_code', '$bin_loc')
        ON DUPLICATE KEY UPDATE
        sr_date = '$sr_date', sr_number = '$sr_number', si_num = '$si_num', s_name = '$s_name', po_num = '$po_num',
        qty = '$qty', mat_code = '$mat_code', mat_desc = '$mat_desc', wh_code = 'wh_code', bin_loc = '$bin_loc'";
        $res_receiving = mysql_query($sql, $con) or die(mysql_error());
    Thank you

  • #2
    Regular Coder
    Join Date
    Feb 2012
    Posts
    123
    Thanks
    19
    Thanked 3 Times in 3 Posts
    Not sure what u're asking..... If u're asking for a redirect back to the previous page then:

    you can use $_SERVER['HTTP_REFERER'] to create a link to send user back to original page

    Two other approaches are to store the <form>'s URI in a hidden input field and use that, or push the REQUEST_URI $_SERVER superglobal value into a $_SESSION variable.

  • #3
    Regular Coder
    Join Date
    Feb 2012
    Posts
    123
    Thanks
    19
    Thanked 3 Times in 3 Posts
    You can use a link to invoke history.go(-1) in Javascript, which is essentially equivalent to clicking the Back button.

    Something like this: echo "<a href=\"javascript:history.go(-1)\">GO BACK</a>";
    Last edited by XCalibre; 03-30-2012 at 01:01 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •