how to send a check box value as a php parameter on a button click -
hi have check box , button opens popup window on button click sending parameter works fine have added check box , want send value parameter , stuck here n have no idea of has done here script
<?php if($addflag == 0){ echo "<td>"; echo '<font color="red"><strong>print on letter head</strong></font><input type="checkbox" id="dtype" name="dtype" value="1" checked></input>'; echo '<input class="cmdprint" type="button" id="submit" name="print" value="print" onclick="window.open(\'quotprin.php?vouchno='.$getvouch.'&dtype=\'document.getelementbyid(\'status1\').value;\'\',\'popupwindow\',\'height=800,width=950,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes\');"></td>'; echo "<td>"; } ?>
somthing should work.
on suggestion try avoid inline js , use functions instead.
other suggestion try use checked="checked"
instead of checked
.
add javascript
<?php if($addflag == 0){ echo ' <script type="text/javascript"> function mopen(){ var mobj=document.getelementbyid(\'dtype\'); var mval=mobj.value; window.open(\'quotprin.php?vouchno='.$getvouch.'&dtype=mval\',\'popupwindow\',\'height=800,width=950,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes\'); </script> '; }
and php
<?php if($addflag == 0){ echo "<td>"; echo '<font color="red"><strong>print on letter head</strong></font> <input type="checkbox" id="dtype" name="dtype" value="1" checked="checked" />'; echo '<input class="cmdprint" type="button" id="submit" name="print" value="print" onclick="mopen();"></td>'; echo "<td>"; } ?>
Comments
Post a Comment