0

Hey there.

I am attempting to create an administrator option, which would be the following:

When the administrator checks the checkbox, it would automatically save it to the db. Usually update it.

while($row = mysql_fetch_array( $retrieve ))
  {
	echo "<td><input type=\"checkbox\" name=\"noutate\"
	 onClick=\"this.form.submit();";
	 if (isset($_POST['checkbox'])) 
	 { 
       $update ="UPDATE content SET noutate='$noutate' WHERE ID='$r_id'";
       mysql_query($update);	 
	 }
	  
	echo "\"";
    echo "value=\"no\""; if($row['noutate']==yes){ echo "CHECKED"; } echo "></td>";

I can't find the problem. Somebody can answer me? Please :D

2
Contributors
1
Reply
5
Views
7 Years
Discussion Span
Last Post by saiprem
0

Your checkbox name is "noutate"
So you need to change the your if and update query like this

if (isset($_POST['noutate'])) {
 $update ="UPDATE content SET noutate='".$_POST['noutate']."' WHERE ID='$r_id'";
}

Hey there.

I am attempting to create an administrator option, which would be the following:

When the administrator checks the checkbox, it would automatically save it to the db. Usually update it.

while($row = mysql_fetch_array( $retrieve ))
  {
	echo "<td><input type=\"checkbox\" name=\"noutate\"
	 onClick=\"this.form.submit();";
	 if (isset($_POST['checkbox'])) 
	 { 
       $update ="UPDATE content SET noutate='$noutate' WHERE ID='$r_id'";
       mysql_query($update);	 
	 }
	  
	echo "\"";
    echo "value=\"no\""; if($row['noutate']==yes){ echo "CHECKED"; } echo "></td>";

I can't find the problem. Somebody can answer me? Please :D

Edited by saiprem: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.