Forms and checkbox

Discussion in 'HTML' started by Luc, Dec 30, 2003.

  1. Luc

    Luc Guest

    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
    Luc, Dec 30, 2003
    #1
    1. Advertising

  2. Luc

    Jay Guest

    "Luc" <> wrote in message
    news:bsrnqm$3sn$...
    > 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
    Jay, Dec 30, 2003
    #2
    1. Advertising

  3. Luc

    Bob Guest

    On Tue, 30 Dec 2003 12:37:39 +0100, "Luc" <> wrote:

    >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.
    Bob, Dec 31, 2003
    #3
  4. Luc

    Luc Guest

    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" <> a écrit dans le message de
    news:prmIb.37410$...

    "Luc" <> wrote in message
    news:bsrnqm$3sn$...
    > 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
    Luc, Dec 31, 2003
    #4
  5. Luc

    Luc Guest

    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" <> a écrit dans le message de
    news:...
    On Tue, 30 Dec 2003 12:37:39 +0100, "Luc" <> wrote:

    >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.
    Luc, Dec 31, 2003
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tshad
    Replies:
    0
    Views:
    510
    tshad
    Apr 15, 2005
  2. Vikram

    disable checkbox list checkbox

    Vikram, Jan 25, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    1,383
    ThunderMusic
    Jan 25, 2006
  3. =?Utf-8?B?RG90TmV0RGV2?=

    DataGrid and embeded Checkbox..How to find if checkbox clicked

    =?Utf-8?B?RG90TmV0RGV2?=, Oct 6, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    807
    David Wier
    Oct 6, 2006
  4. Jason Huang
    Replies:
    0
    Views:
    539
    Jason Huang
    Jun 29, 2007
  5. Eric
    Replies:
    2
    Views:
    498
Loading...

Share This Page