Hi, I want to update one of my tables in a database, when the user checks the checkbox.
I am running update query for the same.When I echo that query, I came to know that it is not taking the checkbox name .. Can someone please help me out with this..
here's the code

echo "<table border=1 align=center>";
        echo "<tr>";

        while($row = mysql_fetch_array($sellexe);)
        {
    echo "<td colspan='3' align='right'><input type='checkbox' name='scow'>Sell"
         }
        echo "<td><input type='submit' name='submit' value='submit'></td>";
        echo "</tr>";
        echo "</table>";

$se = $_POST[scow];
//cho "$se";
        if(isset($_POST['submit']))
    {
        $inssell = "UPDATE `farmlogin` SET `sellcow` = '$se' WHERE `cowid`='$id'";
        //echo "$inssell";
        $s = mysql_query($inssell);
    }

You will only have value in $se = $_POST[scow]; if that checkbox is checked and form is submitted.
and value must be there for checkbox field.and whatever is value will be comes in $se. here $se will be 1.

echo "<td colspan='3' align='right'><input type='checkbox' value='1' name='scow'>Sell"

You will only have value in $se = $_POST[scow]; if that checkbox is checked and form is submitted.
and value must be there for checkbox field.and whatever is value will be comes in $se. here $se will be 1.

echo "<td colspan='3' align='right'><input type='checkbox' value='1' name='scow'>Sell"

I made the changes.. but still nothing $se is not taking any value..

You may wanna double check you're not missing the '' in POST? As in your example.

Debug code using printing post array.And post your output.
BTW where is your form tag as this code is partial?

<?
	echo "<table border=1 align=center>";
	echo "<tr>";
	
	while($row = mysql_fetch_array($sellexe)
	{
	echo "<td colspan='3' align='right'><input type='checkbox' name='scow'>Sell"
	}
	echo "<td><input type='submit' name='submit' value='submit'></td>";
	echo "</tr>";
	echo "</table>";
	
	$se = $_POST[scow];
	//cho "$se";
	if(isset($_POST['submit']))
	{
		echo '<pre>';
		print_r($_POST);
		exit;
		
	$inssell = "UPDATE `farmlogin` SET `sellcow` = '$se' WHERE `cowid`='$id'";
	//echo "$inssell";
	$s = mysql_query($inssell);
	} 
?>