Jump to content

Jaminxz


jaminxz

Recommended Posts

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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