balwantsingh wrote:
can somebody advise me
i want to use checkboxes on my website, i want that if user selects some
checkboxes (there will be more than 20 checkboxes), checkbox's value will be
stored in variables and than SELECT query command will be run using these
variables through PHP. but my
=Opening_Units
Unit_Consumedinput type=checkbox name=ch3 value=Unit_Consumed
-Original Message-
From: John Holmes [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 18, 2004 5:43 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Check Boxes
balwantsingh wrote:
can
Unit_Consumedinput type=checkbox name=ch3 value=Unit_Consumed
-Original Message-
From: John Holmes [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 18, 2004 5:43 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Check Boxes
balwantsingh wrote:
can
On 18 August 2004 11:24, randy wrote:
$chkboxes = $_POST['ch'];
$sql = 'SELECT ';
foreach($chkboxes as $k = $v)
{
$sql .= $v;
if($k (sizeof($chkboxes) - 1))
{
$sql .= ', ';
}
}
$sql .= ' FROM form';
$sql = 'SELECT ' . implode(', ', $chkboxes) .
yeah yeah...it's damn near 4 in the morning here...my brain isn't
exactly on at the moment.
:)
On Wed, 18 Aug 2004 11:35:59 +0100, Ford, Mike [LSS]
[EMAIL PROTECTED] wrote:
On 18 August 2004 11:24, randy wrote:
$chkboxes = $_POST['ch'];
$sql = 'SELECT ';
foreach($chkboxes
Ford, Mike [LSS] wrote:
$chkboxes = $_POST['ch'];
$sql = 'SELECT ';
foreach($chkboxes as $k = $v)
{
$sql .= $v;
if($k (sizeof($chkboxes) - 1))
{
$sql .= ', ';
}
}
$sql .= ' FROM form';
$sql = 'SELECT ' . implode(', ', $chkboxes) . 'FROM form';
On 18 August 2004 15:53, John Holmes wrote:
Ford, Mike [LSS] wrote:
$chkboxes = $_POST['ch'];
$sql = 'SELECT ';
foreach($chkboxes as $k = $v)
{
$sql .= $v;
if($k (sizeof($chkboxes) - 1))
{
$sql .= ', ';
}
}
$sql .= ' FROM form';
On Wednesday 18 August 2004 20:07, Ford, Mike [LSS] wrote:
$sql = 'SELECT ' . implode(', ', $chkboxes) . 'FROM form';
Just note that with either solution, someone can post a value of *
FROM table WHERE 1# and see everything in any table in your database.
I was waiting for someone to
John,
There a few good threads in the PHP-DB archives that will guide you through
implementing your check box solution. Here is one of the most recent:
http://marc.theaimsgroup.com/?l=php-dbm=104610149123353w=2
In the past, I've implemented check boxes for the purpose of deleting News
items
I usually store the value as a 0 (unchecked) or a 1(checked) in a char(1)
field. Then, in populating the form my input has something like ?PHP echo
(fieldname==1?' CHECKED ':'';? There are other ways of doing it. (Warning,
I'm not actually LOOKING at my code at the moment so YMMV.)
HTH,
=C=
*
Sometimes, PHP becaomes confused when a variable is included in another
word, such as you are doing with $i in:
if($HTTP_POST_VARS[chkAuthStatus_$i] = 'on')
To avoid this problem, use braces to segregate the PHP variable from the
rest of the word:
try: if($HTTP_POST_VARS[chkAuthStatus_${i}] =
-Original Message-
From: Jason G. [mailto:[EMAIL PROTECTED]]
Sent: 03 October 2001 12:12
To: Matt C; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Check Boxes/UPDATE
Matt,
Assuming that you have a variable number of records being displayed out of
the database:
As you write out the HTML
I am sorry but I still really don't get it :(
How do I do the array thing?
_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail:
Boxes/UPDATE
I am sorry but I still really don't get it :(
How do I do the array thing?
-Original Message-
From: Jason G. [mailto:[EMAIL PROTECTED]]
Sent: 03 October 2001 12:12
To: Matt C; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Check Boxes/UPDATE
Matt,
Assuming that you have
-Original Message-
From: Matt C [mailto:[EMAIL PROTECTED]]
Sent: 03 October 2001 23:17
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Check Boxes/UPDATE
I am sorry but I still really don't get it :(
How do I do the array thing?
Please specify *which* part you don't
Hiya Matt
you have to set the value of the checkbox to 1, and give it a unique
name.
if the user has checked the box when they submit the form then the
checkbox' name will have a value of 1. if they didn't check it it won't
have a value at all.
Hope this helps!
Dave
-Original
Matt,
Assuming that you have a variable number of records being displayed out of
the database:
As you write out the HTML, give each checkbox a name containing the ID# of
the record that is being written out. Ex:
input type=check name=chkAuthStatus_1203 checked
input type=check
17 matches
Mail list logo