Forms and checkbox

L

Luc

Hello,

I would like to use a checkbox in a form for a boolean field (mysql type :
tinyint(1)), but when i write :

<input type="checkbox" name="notify" value="{NOTIFY}" >

the box is not checked if the value of the field is already equal to 1.

What did i do wrong ?

(If i write : <input type="text" name="notify" value="{NOTIFY}" > , then
the form shows "1")

Thanks for your help
 
J

Jay

Luc said:
Hello,

I would like to use a checkbox in a form for a boolean field (mysql type :
tinyint(1)), but when i write :

<input type="checkbox" name="notify" value="{NOTIFY}" >

What is {NOTIFY}? Is it an variable/integer in your code?
the box is not checked if the value of the field is already equal to 1.

What did i do wrong ?

Need more information to see what you're trying to do.
(If i write : <input type="text" name="notify" value="{NOTIFY}" > , then
the form shows "1")

The Johnny Carson hat is on but I'm not seeing anything...

- J
 
B

Bob

Hello,

I would like to use a checkbox in a form for a boolean field (mysql type :
tinyint(1)), but when i write :

<input type="checkbox" name="notify" value="{NOTIFY}" >

the box is not checked if the value of the field is already equal to 1.

What did i do wrong ?

I'm not sure I understand your question, but the checkbox will be
checked when the form first appears *if* you put the "checked"
keyword on the tag:

<input type="checkbox" name="notify" value="{NOTIFY}" CHECKED >

You should realize that your program is going to get a passed
field named "notify" which contains "{NOTIFY}" as the data
value.
 
L

Luc

Thanks
What is {NOTIFY}? Is it an variable/integer in your code?
{NOTIFY} was the value in the mysql table
the mysql type is "tinyint" which i read is equivalent to boolean for mysql

in fact i am using now 2 differents codes according to the value of the
variable

<input type="checkbox" name="notify" value1 CHECKED > if it is 1
<input type="checkbox" name="notify" value=0 > if it is 0

I do not know if it is the rigth way to do it but it wrks

thanks for your help

"Jay" <[email protected]> a écrit dans le message de

Luc said:
Hello,

I would like to use a checkbox in a form for a boolean field (mysql type :
tinyint(1)), but when i write :

<input type="checkbox" name="notify" value="{NOTIFY}" >

What is {NOTIFY}? Is it an variable/integer in your code?
the box is not checked if the value of the field is already equal to 1.

What did i do wrong ?

Need more information to see what you're trying to do.
(If i write : <input type="text" name="notify" value="{NOTIFY}" > , then
the form shows "1")

The Johnny Carson hat is on but I'm not seeing anything...

- J
 
L

Luc

Thanks for your help
I did not know i had to write "checked" is the valeu was already to 1
I am using now 2 differents codes according to the value of the variable

<input type="checkbox" name="notify" value=1 CHECKED > if it is 1
<input type="checkbox" name="notify" value=0 > if it is 0

I do not know if it is the rigth way to do it but it works

thanks for your help

"Bob" <[email protected]> a écrit dans le message de
Hello,

I would like to use a checkbox in a form for a boolean field (mysql type :
tinyint(1)), but when i write :

<input type="checkbox" name="notify" value="{NOTIFY}" >

the box is not checked if the value of the field is already equal to 1.

What did i do wrong ?

I'm not sure I understand your question, but the checkbox will be
checked when the form first appears *if* you put the "checked"
keyword on the tag:

<input type="checkbox" name="notify" value="{NOTIFY}" CHECKED >

You should realize that your program is going to get a passed
field named "notify" which contains "{NOTIFY}" as the data
value.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top