nestorvaldez Posted October 2, 2006 Share Posted October 2, 2006 Hi...I need to update an status Field in my table..I have a List (select query) and one of the field in thelist is a checkbox form (this checkbox is a field in the table) I just need to adjust the status. If I marked the checkbox it save 1 and if it is unmarked it it will save 0. I use a bottom at the end of the form to make this update.I found some code, but it doesn't work.. I will show it, I hope I could get some help here.This is some code in the List:$updatelink="<p align=\"right\"><a href=\"actstatus.php?personal=$id&did=$did\"><p align=\"right\"><img border=\"0\" src=\"../../images/actstatus.jpg\"alt=\"Update Docs Status\">";echo ("$updatelink");[actstatus.php]<?phpinclude("../../functions/db.php");$personal = $_GET['personal']; $did = $_REQUEST['did'];foreach ($did as $key => $value){ $p = "$value"; echo $p; $query = mysql_query("UPDATE regdocu SET RDOC_STATUS= WHERE RDOC_PERSONAL='$personal' AND RDOC_DOCU='$did'"); }if(!$query){ echo '<p><b><font face="Arial" color="#CE0808" style="font-size: 9pt">Error<span lang="es-do">:</span> </font></b><font face="Arial" style="font-size: 9pt" color="#CE0808">No se pudo actualizar status del Documento Contacte el administrador.</font></p>'; } else {echo ("<meta http-equiv=\"refresh\" content=\"5; url=./fnuevo.php?id=$personal\">");} ?> Quote Link to comment Share on other sites More sharing options...
alpine Posted October 2, 2006 Share Posted October 2, 2006 There is a lot of things that might be the problem here, but the first thing you have to do is tell the query WHAT to set as status:SET RDOC_STATUS='[color=red]whatever[/color]' WHERE.... Quote Link to comment Share on other sites More sharing options...
michaellunsford Posted October 2, 2006 Share Posted October 2, 2006 Checkboxes don't post (or get either) if they aren't checked. You should use a radio button, select box, or something else instead.If you it has to be a checkbox, you can remove it from the form and have javascript change the value of a hidden field.PS > I did read your code (and don't see a checkbox). Is this topic titled correctly? Quote Link to comment Share on other sites More sharing options...
nestorvaldez Posted October 2, 2006 Author Share Posted October 2, 2006 Yes I know About the SET in the STATUS, what I need to set is what I check in the checkbox in the list.If mark it I need to move 1 if I dont I what to move 0.That is the only thing I need to do.. update in the table what i check.But I dont know if the code is correct? Help me with this..... Quote Link to comment Share on other sites More sharing options...
michaellunsford Posted October 2, 2006 Share Posted October 2, 2006 you [u]could[/u] set a variable based on the existance of that $_POST.[code=php:0]$my_new_var=is_set($_POST['checkboxname']);[/code]if it exists, you get a 1, if not, you get a 0. Quote Link to comment Share on other sites More sharing options...
nestorvaldez Posted October 2, 2006 Author Share Posted October 2, 2006 I cant get it.. This is all the code of the two files:and this is the link of the file to see what I have:http://www.internationaljobagency.com/fnuevo.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.