Jump to content

If checkbox checked problem


tezza42

Recommended Posts

I am using the following piece of code to open a new window when a checkbox is checked...

 

<INPUT type="checkbox" name="name" value="YES" onClick="window.open('/somepage.php?do=something&id=<?php echo $SOMEID["id"] ?>','','width=600,height=350,left=100,top=100,screenX=100,screenY=100')">

 

The page opens ok when the checkbox is ticked (checked).

 

PROBLEM:

The page opens again if the checkbox is un-ticked (un-checked).

 

I just want to open the page if the checkbox is ticked only but not sure how to do this?

 

OTHER INFO:

Seperate checkboxes are dynamically created on the page for each  id=<?php echo $SOMEID["id"] ?>

Link to comment
https://forums.phpfreaks.com/topic/214015-if-checkbox-checked-problem/
Share on other sites

<script type="text/javascript">

function doPopup(id, isChecked)
{
if(isChecked)
{
	window.open('/somepage.php?do=something&id=' + id,'','width=600,height=350,left=100,top=100,screenX=100,screenY=100');
}
}

</script>

<INPUT type="checkbox" name="name" value="YES" onClick="doPopup('<?php echo $SOMEID["id"] ?>', this.checked)">

Archived

This topic is now archived and is closed to further replies.

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