Page 1 of 1

Checkboxes, forms and mysql question?

Posted: Sat Sep 21, 2002 2:56 pm
by lexena
How do i get a "1" passed to a table by using a variables for each column that is a checkbox?

for example:

."<input type=\"checkbox\" name=\"$oedit\" value=\"1\"><b>"._OEDIT."</b>"._OEDITD."<br>"

The check boxes appear fine in the form but when tested, nothing shows up in the table when they are 'checked'. Also some more background info:

The table columns that are used for the checkboxes are all 'tinyint' notnull and have '0's in them by default. When the checkboxes are checked, they are supposed to insert a 1 into the corresponding column. Any suggestions would be appreciated! :)

Posted: Sat Sep 21, 2002 6:12 pm
by Coco
ahhh im so drunk 8O

firstly your form action would need to be a php page (or itself with the coding as required)

in your code you will need to have something along the lines of:

Code: Select all

&lt;?php
mysql_query("UPDATE $table SET monkey = $Value WHERE bananas = $wibble")
?&gt;
umm....
im kinda drunk :(
maybe this will help (doubt it)
http://www.mysql.com/doc/en/UPDATE.html

*tries to think*
i reckon that will help :?

Thanx anywayz

Posted: Mon Sep 30, 2002 1:21 pm
by lexena
I figured out what I was doing and it worx great! :D

Thanx for your reply but it wasn't really relavent to what I was doing.