Hi frnds,


I want activate the textbox when i select the particular checkbox in php.Anybody know send that coding ......

try this one

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="javascript">
function start() {

window.document.formx.email.disabled = true;

}
onload = start;
function chgtx1()
{

window.document.formx.email.disabled = !window.document.formx.blow.checked;


}
</script>
</head>

<body>
 <form name="formx" action="" method="post" >
 <table>
 <tr>
        <td>  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
           <input type="text" class="top_navtextfield" style="color:lightgrey" size=40 name="email" value="Enter Email Here" 
  onfocus="if (this.className=='top_navtextfield') { this.className = ''; this.value = '';this.style.color = 'black';}"
  onblur="if (this.value == '') { this.className = 'top_navtextfield'; this.value = 'Enter Email Here'; this.style.color = 'lightgrey'; }" ></td>
          <td width="235"><input type="checkbox" value="9.95" name="blow" id="blow" class="medium" onClick="chgtx1();" /></td>
        </tr></table>
		</form>
</body>
</html>

Same code for multiple textbox and checkbox.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="javascript">
function enableMe(fld)
{
	eval('window.document.formx.'+fld+'.disabled = !window.document.formx.'+fld+'CB'+'.checked');	
}
</script>
</head>

<body>
 <form name="formx" action="" method="post" >
 <table>
 <tr>
        <td>
			<input type="text" disabled="disabled" name="firstbox" value="First box" >
  		</td>
        <td width="235">
			<input type="checkbox" value="1" name="firstboxCB" onClick="enableMe('firstbox');" />
		</td>
 </tr>
 <tr>
        <td>
			<input type="text" disabled="disabled" name="secondbox" value="Second box" >
  		</td>
        <td width="235">
			<input type="checkbox" value="1" name="secondboxCB" onClick="enableMe('secondbox');" />
		</td>
 </tr>
 </table>
 </form>
</body>
</html>

if your problem solved mark as solved thread.

if i want to use this script in php using while loop then how can I control this ?
my code is below

<form name="frmLarge" id="frmLarge" method="post" action="addinq.php?MSecID=<?=$MSecID?>"> 
<input type="hidden" name="p_id" value="<?=$rs['recid'];?>" />
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                      <tr>
                                        <td align="center"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                          <tr>
                                            <td width="45" align="left" class="bray">&nbsp;</td>
                                            <td width="45" align="left" class="bray"><span class="pro_detail">Color:</span></td>
                                            <td width="65" height="25" align="left" class="pro_detail">Quantity:</td>
                                            </tr>
<?php
$sqlSize_clr = "SELECT * FROM tbl_product_colors WHERE product_id = ".$rs['recid']." ORDER BY product_size_id";
	$qrySize_clr = dbQuery($sqlSize_clr);
		while ($rs_clr=dbFetchArray($qrySize_clr)){
			
$sql_clr = dbQuery("select * from tbl_sizes where s_id = ".$rs_clr['size_id']." order by rank ");
	$get_clr = dbFetchArray($sql_clr);
?>
<tr>
  <td align="center" class="bray"><input type="checkbox" value="1" name="firstboxCB" onClick="enableMe('qty[<?=$get_clr['s_id'];?>]');" /></td>
<td height="25" align="left" class="bray"><?=$get_clr['size'];?></td>
<td align="left" class="bray"><span class="pro_detail">
<input name="qty[<?=$get_clr['s_id'];?>]" type="text" id="qty[<?=$get_clr['s_id'];?>]"  style="width:50px; height:18px; line-height:18px; font-family:Arial; font-size:12px; color: #666666; border: solid 1px #8c8c8c;" value="10" disabled="disabled" />
</span></td>
</tr>
<?
}
?>
                                          
                                          </table></td>
                                        <td width="50%" align="right"><table width="80%" border="0" cellspacing="0" cellpadding="0">
                                          <tr>
                                            <td align="left"><input type="image" src="images/add_cart.jpg" width="103" height="19" /></td>
                                          </tr>
                                          <tr>
                                            <td align="left">&nbsp;</td>
                                          </tr>
                                          <tr>
                                            <td align="left">
<a href="<?=$img;?>" rel="lightbox">
                                            <img src="images/zoom.jpg" width="72" height="19" />
                                            </a>
                                            </td>
                                          </tr>
                                        </table></td>
                                      </tr>
                                    </table>
</form>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.