[PHP-DB] Checkboxes, PHP, and MySQL

2001-12-20 Thread SpyProductions Support Team


I've looked around in a few of the PHP lists for an answer to this, but
can't come up with one.

Here's what I am doing:

I have a form with a few checkboxes.

When the information as to whether the checkboxes are checked or not is
'saved' into the MySQL table, they are represented by a value of '1' - fine.

When I want to edit this information, in the form of a similar form with
checkboxes, the boxes are not checked off if they were before.

What I am stuck on is how a checkbox can get checked off when pulling
information from the MySQL as an array.

Here's a line of code showing my array coming out.

input type=checkbox name=firstvalue value='$result[32]'

$result is the array.

I guess what I am asking is that if a checkbox is assigned a value of one,
why doesn't it appear as already checked off?

Thanks,

-Mike


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Checkboxes, PHP, and MySQL

2001-12-20 Thread Paul DuBois

On Thu, Dec 20, 2001 at 11:40:14AM -0500, SpyProductions Support Team wrote:
 I've looked around in a few of the PHP lists for an answer to this, but
 can't come up with one.

On this question, you'd be better off just reading an HTML reference.
It doesn't matter what the value of a checkbox is.  If you want it
to appear checked when the browser displays it, you should supply a
checked attribute:

input type=checkbox name=firstvalue value=$result[32] checked

 
 Here's what I am doing:
 
 I have a form with a few checkboxes.
 
 When the information as to whether the checkboxes are checked or not is
 'saved' into the MySQL table, they are represented by a value of '1' - fine.
 
 When I want to edit this information, in the form of a similar form with
 checkboxes, the boxes are not checked off if they were before.
 
 What I am stuck on is how a checkbox can get checked off when pulling
 information from the MySQL as an array.
 
 Here's a line of code showing my array coming out.
 
 input type=checkbox name=firstvalue value='$result[32]'
 
 $result is the array.
 
 I guess what I am asking is that if a checkbox is assigned a value of one,
 why doesn't it appear as already checked off?
 
 Thanks,
 
 -Mike

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Checkboxes, PHP, and MySQL

2001-12-20 Thread Jonathan Hilgeman

It's not the checkbox's VALUE attribute that determines whether it is
checked or not. If you add the empty attribute CHECKED, then the checkbox
will be checked.

Example:

INPUT TYPE='Checkbox' NAME='VarCheck1' VALUE='Good' CHECKED
INPUT TYPE='Checkbox' NAME='VarCheck2' VALUE='Good'

VarCheck1 will be checked, and VarCheck2 will not be checked. A checkbox
will only have a value on submission IF IT IS CHECKED. So if the above two
boxes were submitted and VarCheck1 was checked and VarCheck2 was not
checked, the new page would have the variable VarCheck1 containing Good,
while VarCheck2 would be empty/non-existent. 

- Jonathan

-Original Message-
From: SpyProductions Support Team [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 20, 2001 8:40 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Checkboxes, PHP, and MySQL



I've looked around in a few of the PHP lists for an answer to this, but
can't come up with one.

Here's what I am doing:

I have a form with a few checkboxes.

When the information as to whether the checkboxes are checked or not is
'saved' into the MySQL table, they are represented by a value of '1' - fine.

When I want to edit this information, in the form of a similar form with
checkboxes, the boxes are not checked off if they were before.

What I am stuck on is how a checkbox can get checked off when pulling
information from the MySQL as an array.

Here's a line of code showing my array coming out.

input type=checkbox name=firstvalue value='$result[32]'

$result is the array.

I guess what I am asking is that if a checkbox is assigned a value of one,
why doesn't it appear as already checked off?

Thanks,

-Mike


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Checkboxes, PHP, and MySQL

2001-12-20 Thread matt stewart

the value doesn't determine whether it's checked or not - it determines the
value passed WHEN it's checked.
try the lines below:
echoinput type=/checkbox/ name=/firstvalue/ value=/1/;
if ($result[32] == 1){
echo checked;
}else{
echo;
}
or something along these lines.

-Original Message-
From: SpyProductions Support Team [mailto:[EMAIL PROTECTED]]
Sent: 20 December 2001 16:40
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Checkboxes, PHP, and MySQL



I've looked around in a few of the PHP lists for an answer to this, but
can't come up with one.

Here's what I am doing:

I have a form with a few checkboxes.

When the information as to whether the checkboxes are checked or not is
'saved' into the MySQL table, they are represented by a value of '1' - fine.

When I want to edit this information, in the form of a similar form with
checkboxes, the boxes are not checked off if they were before.

What I am stuck on is how a checkbox can get checked off when pulling
information from the MySQL as an array.

Here's a line of code showing my array coming out.

input type=checkbox name=firstvalue value='$result[32]'

$result is the array.

I guess what I am asking is that if a checkbox is assigned a value of one,
why doesn't it appear as already checked off?

Thanks,

-Mike


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.307 / Virus Database: 168 - Release Date: 11/12/01
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.307 / Virus Database: 168 - Release Date: 11/12/01
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Checkboxes, PHP, and MySQL

2001-12-20 Thread Jason Wong

On Friday 21 December 2001 00:40, SpyProductions Support Team wrote:
 I've looked around in a few of the PHP lists for an answer to this, but
 can't come up with one.

 Here's what I am doing:

 I have a form with a few checkboxes.

 When the information as to whether the checkboxes are checked or not is
 'saved' into the MySQL table, they are represented by a value of '1' -
 fine.

 When I want to edit this information, in the form of a similar form with
 checkboxes, the boxes are not checked off if they were before.

 What I am stuck on is how a checkbox can get checked off when pulling
 information from the MySQL as an array.

 Here's a line of code showing my array coming out.

 input type=checkbox name=firstvalue value='$result[32]'

 $result is the array.

 I guess what I am asking is that if a checkbox is assigned a value of one,
 why doesn't it appear as already checked off?

value='XXX' only specifies what the value would be *if* the checkbox was 
checked. To actually *set* the checkbox you need:

 input type=checkbox name=firstvalue value='$result[32]' checked

hth
-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
Always there remain portions of our heart into which no one is able to enter,
invite them as we may.
*/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Checkboxes, PHP, and MySQL

2001-12-20 Thread Jonathan Hilgeman

Or a better, more-visual way might be:

?
if($result[32] == 1)
 $Checked = CHECKED;
else
 $Checked = ;

print INPUT TYPE='Checkbox' NAME='firstvalue' VALUE='1' $Checked;
?

- Jonathan

-Original Message-
From: matt stewart [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 20, 2001 8:45 AM
To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Checkboxes, PHP, and MySQL


the value doesn't determine whether it's checked or not - it determines the
value passed WHEN it's checked.
try the lines below:
echoinput type=/checkbox/ name=/firstvalue/ value=/1/;
if ($result[32] == 1){
echo checked;
}else{
echo;
}
or something along these lines.

-Original Message-
From: SpyProductions Support Team [mailto:[EMAIL PROTECTED]]
Sent: 20 December 2001 16:40
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Checkboxes, PHP, and MySQL



I've looked around in a few of the PHP lists for an answer to this, but
can't come up with one.

Here's what I am doing:

I have a form with a few checkboxes.

When the information as to whether the checkboxes are checked or not is
'saved' into the MySQL table, they are represented by a value of '1' - fine.

When I want to edit this information, in the form of a similar form with
checkboxes, the boxes are not checked off if they were before.

What I am stuck on is how a checkbox can get checked off when pulling
information from the MySQL as an array.

Here's a line of code showing my array coming out.

input type=checkbox name=firstvalue value='$result[32]'

$result is the array.

I guess what I am asking is that if a checkbox is assigned a value of one,
why doesn't it appear as already checked off?

Thanks,

-Mike


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.307 / Virus Database: 168 - Release Date: 11/12/01
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.307 / Virus Database: 168 - Release Date: 11/12/01
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Checkboxes, PHP, and MySQL

2001-12-20 Thread Jim Lucas

Try this

input type=checkbox name=firstvalue ?=($result[32]?checked:)?

Jim
- Original Message -
From: SpyProductions Support Team [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, December 20, 2001 8:40 AM
Subject: [PHP-DB] Checkboxes, PHP, and MySQL



 I've looked around in a few of the PHP lists for an answer to this, but
 can't come up with one.

 Here's what I am doing:

 I have a form with a few checkboxes.

 When the information as to whether the checkboxes are checked or not is
 'saved' into the MySQL table, they are represented by a value of '1' -
fine.

 When I want to edit this information, in the form of a similar form with
 checkboxes, the boxes are not checked off if they were before.

 What I am stuck on is how a checkbox can get checked off when pulling
 information from the MySQL as an array.

 Here's a line of code showing my array coming out.

 input type=checkbox name=firstvalue value='$result[32]'

 $result is the array.

 I guess what I am asking is that if a checkbox is assigned a value of one,
 why doesn't it appear as already checked off?

 Thanks,

 -Mike


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]