jaminxz Posted March 4, 2009 Share Posted March 4, 2009 Hello, firstly this is a bit of a gray area so it could possibly belong in another forum such as PHP, HTML help or something, but since i think the problem is mainly javascript 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: <input type="submit" value="Close" ID="<?php echo $row_query4['ID']; ?>" onclick="return confirm_delete('<?php echo $row_query4['ID']; ?>')" /> Here is the Jscript: <script type="text/javascript"> var form_id; function confirm_delete(ID) { var cycles = prompt("Close at how many cycles?", " <?php echo $total_cycles ?>"); if(cycles){ var CycleClose = cycles; var id = ID; document.getElementById('IDval').value = id; document.getElementById('CycleClose').value = CycleClose; return true; } else { alert('You didn\'t provide a value for cycles.'); return false; } } </script> and the hidden form code <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: //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, jaminxz. Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted March 4, 2009 Share Posted March 4, 2009 there is no javascipt errors but <?php echo $total_cycles ?> should be: <?php echo $total_cycles; ?> Quote Link to comment Share on other sites More sharing options...
jaminxz Posted March 4, 2009 Author Share Posted March 4, 2009 fixed that and uploaded but it still doesnt work. Does anyone have any idea why the whole page could be white? I'm totally lost. Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted March 4, 2009 Share Posted March 4, 2009 http://www.coderanch.com/t/112054/HTML-JavaScript/check-if-browser-close-button Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.