Member Avatar for Pityu

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

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

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.