Hello. I am making a script for my webcam recorder our clients will be able to view and choose what ones they want on there profile. For some reason I cant get this to work right.. onces they check on the checkboxs it will be approve to be on the profile we only want them to use only one webcam images on the profile.. They can have as much as they want but only one can be on the profile.. I am not sure how to really do that part.. $approve=$_POST['v']; $v=$_POST['filename']; // remove listing from database phpfox_mysql_query("UPDATE video SET approve = '$approve' WHERE filename='$v'"); PHP: <form method="post" action="recorded.php"> <table style="width:100%;" class="border13" cellspacing="5"> <tr> <input type="hidden" name="filename" value="'.$board2['filename'].'"> <input type="hidden" name="v" value="0"> <td style="width:30%;font-size:8pt;" class="color"> <span> <input type="checkbox" name="v" value="1" > </span> </td> <td style="width:30%;font-size:8pt;" class="color"> <span>'.$board2['userid'].'</span> </td><td style="width:15%;font-size:8pt;" class="color"> <b> '.date("F j, Y, g:i a",$board2['date']).'</b> </td><td style="width:55%;font-size:8pt;" class="memlink"> '.$board2['filename'].' </td> </tr></table> <input type="submit" value="Submit" name="Submit"></form> HTML: Hope someone can help me out..
You are not checking that check box is checked or not. If a member/visitor of your site did not check the check box, you will not receive any value for this checkbox after form submit. In your case if checkbox is unchecked than $_POST['filename'] does not exist. So check it this way if(isset($_POST['filename'])) $allow_img = 1; else $allow_img = 0;// use this $allow_img in sql WHERE filename='$allow_img'" PHP:
Do I still keep this in there $approve=$_POST['v']; $v=$_POST['filename']; // remove listing from database phpfox_mysql_query("UPDATE video SET approve = '$approve' WHERE filename='$v'"); PHP: Approve is where the check box is value is 1 so it will show up.. if not check it should show 0