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

    updating record status with button

    Hello, firstly this is a bit of a gray area so it could possibly belong in another forum such as javascript, HTML help or something, but since i think the problem is php related i'm going to post it here (sorry if i'm wrong!).

    I have a php page which displays results from a MySQL table if a record's status is set to 'Open'. Every row has a 'close' button whch updates a records status to 'closed', here is the code for that:

    Code: [Select]
    <input type="submit" value="Close" ID="<?php echo $row_query4['ID']; ?>" onclick="return confirm_delete('<?php echo $row_query4['ID']; ?>')" />

    Here is the Jscript:

    Code: [Select]
    <script type="text/javascript">

    var form_id;
    function confirm_delete(ID)
    var cycles = prompt("Close at how many cycles?", " <?php echo $total_cycles ?>");

    var CycleClose = cycles;
    var id = ID;
    document.getElementById('IDval').value = id;
    document.getElementById('CycleClose').value = CycleClose;
    return true;
    alert('You didn\'t provide a value for cycles.');
    return false;

    and the hidden form code

    Code: [Select]
    <input type="hidden" name="IDval" id="IDval"><input type="hidden" name="CycleClose" id="CycleClose">
    and the php post code that accepts a value on postback:

    Code: [Select]
    //If IS_PostBack then database is to be updated
    if(isset($_POST['IDval']) && isset($_POST['CycleClose'])){
    // if($_POST) {
    //echo "BADGERS";
    $ID_Val = $_POST['IDval'];
    $Cycles_Closed = $_POST['CycleClose'];

    -----------SQL then executed here-------------

    Basically on click of a button, the records status should be updated to 'closed', the page should refresh and then the table should be rebuilt (but not contain the row that has just been updated because its status is now 'closed').

    this works perfectly in my local environment, but i've uploaded it to my college's webserver and it does not work properly: when the close button is clicked and then a value entered into the prompt box, the page refreshes and its totally white, the SQL update command doesnt get executed and thus the table isn't updated either.

    I dont even know where to start debugging this, can anybody help?

    thanks in advance,

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Thanked 2,224 Times in 2,211 Posts
    the page refreshes and its totally white, the SQL update command doesnt get executed and thus the table isn't updated either.
    Guess you've something to do with http://www.codingforums.com/showthre...060#post617060
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Senior Coder
    Join Date
    May 2005
    Thanked 72 Times in 72 Posts
    Please place your code inside the code tags.


    Posting Permissions

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