Re: [PHP] checkboxes

2009-04-24 Thread tedd

At 5:30 PM -0500 4/23/09, Lists wrote:
Tedd, nice looking contact demo thingy.. but PJ has a point. ;-)  It 
would make the app perhaps more intuitive if one could just type 
text in any of the 3 fields and then spit out results that match all 
of the comparisons that are not blank by clicking one button.


.. not to take away from what you have done, but perhaps a future
evolution of the demo.

Donovan



Point taken.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] checkboxes

2009-04-24 Thread PJ
Lists wrote:
> tedd wrote:
>> At 4:58 PM -0400 4/23/09, PJ wrote:
>>>
>>>  >>> tedd wrote:
>>>  >>>  > http://php1.net/a/edit-db-demo/
>>>  >>>
>>>  >H I've looked at your demo and, frankly, don't see it
>>> working.
>>> When I enter names and click on one of the search buttons, I don't get
>>> sane results. For instance, entering Johnson in last name and John in
>>> first name, I click on search first name and I get an entry from page R
>>> for first name John and Last name Raab. Doesn't make sense.
>>
>> PJ:
>>
>> Okay, if you enter "Johnson" in the last name text box and click the
>> "Search Last Name" button, the demo will provide you with a record
>> that has "Johnson" as the last name.
>>
>> Likewise, if you enter "John" in the first name text-box and click
>> the "Search First Name" button, the demo will provide you with a
>> record that has "John" as the first name.
>>
>> Both of those work --  so, where's the confusion?
>>
>> Apparently you want to enter "Johnson" in the last name text box and
>> "John" in the first name text box and then click something to find
>> that specific name right? Well, the demo is not set-up that way --
>> there is no "Click here and I'll find the specific person who has
>> this first and last name".
>>
>> The demo is set up to search for first OR last name OR email address.
>> It also provides a way to sort the records such that one can
>> sequentially step any sort made on first-name/last-name; or
>> last-name/first-name; or email address.
>>
>> It only does what it says it does. Did you review the instructions at
>> the bottom?
>>
>> Cheers,
>>
>> tedd
>
>
> Tedd, nice looking contact demo thingy.. but PJ has a point. ;-)  It
> would make the app perhaps more intuitive if one could just type text
> in any of the 3 fields and then spit out results that match all of the
> comparisons that are not blank by clicking one button.
>
> .. not to take away from what you have done, but perhaps a future
> evolution of the demo.
>
> Donovan
>
Exactly. I expected to get all instances of Johnson or of John but I got
only 1 and I saw that there were others, so that didn't seem right.
And, if I may point out, the instructions are not available if js is not
enabled O:-)   so that leaves only intuition to decipher things
especially if you only want to do a search.

BTW - I seem to have solved the problem of filtering the inputs. Was
rather simple: just use one form for each search.
And to avoid using @ for the error of $_POST['select'] one just has to
declare one just has to declare
$_POST['submit'] = ""; at top of script. :-)  (I'm learning, I'm
learning) - now I have to check it all out.

-- 
unheralded genius: "A clean desk is the sign of a dull mind. "
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] checkboxes

2009-04-23 Thread Lists

tedd wrote:

At 4:58 PM -0400 4/23/09, PJ wrote:


 >>> tedd wrote:
 >>>  > http://php1.net/a/edit-db-demo/
 >>>
 >H I've looked at your demo and, frankly, don't see it working.
When I enter names and click on one of the search buttons, I don't get
sane results. For instance, entering Johnson in last name and John in
first name, I click on search first name and I get an entry from page R
for first name John and Last name Raab. Doesn't make sense.


PJ:

Okay, if you enter "Johnson" in the last name text box and click the 
"Search Last Name" button, the demo will provide you with a record that 
has "Johnson" as the last name.


Likewise, if you enter "John" in the first name text-box and click the 
"Search First Name" button, the demo will provide you with a record that 
has "John" as the first name.


Both of those work --  so, where's the confusion?

Apparently you want to enter "Johnson" in the last name text box and 
"John" in the first name text box and then click something to find that 
specific name right? Well, the demo is not set-up that way -- there is 
no "Click here and I'll find the specific person who has this first and 
last name".


The demo is set up to search for first OR last name OR email address. It 
also provides a way to sort the records such that one can sequentially 
step any sort made on first-name/last-name; or last-name/first-name; or 
email address.


It only does what it says it does. Did you review the instructions at 
the bottom?


Cheers,

tedd



Tedd, nice looking contact demo thingy.. but PJ has a point. ;-)  It 
would make the app perhaps more intuitive if one could just type text in 
any of the 3 fields and then spit out results that match all of the 
comparisons that are not blank by clicking one button.


.. not to take away from what you have done, but perhaps a future
evolution of the demo.

Donovan



--
  =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o
  D. BROOKE   EUCA Design Center
   WebDNA Software Corp.
  WEB:> http://www.euca.us  |   http://www.webdna.us
  =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o
  WebDNA: [** Square Bracket Utopia **]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] checkboxes

2009-04-23 Thread tedd

At 4:58 PM -0400 4/23/09, PJ wrote:


 >>> tedd wrote:
 >>>  > http://php1.net/a/edit-db-demo/
 >>>
 >H I've looked at your demo and, frankly, don't see it working.
When I enter names and click on one of the search buttons, I don't get
sane results. For instance, entering Johnson in last name and John in
first name, I click on search first name and I get an entry from page R
for first name John and Last name Raab. Doesn't make sense.


PJ:

Okay, if you enter "Johnson" in the last name text box and click the 
"Search Last Name" button, the demo will provide you with a record 
that has "Johnson" as the last name.


Likewise, if you enter "John" in the first name text-box and click 
the "Search First Name" button, the demo will provide you with a 
record that has "John" as the first name.


Both of those work --  so, where's the confusion?

Apparently you want to enter "Johnson" in the last name text box and 
"John" in the first name text box and then click something to find 
that specific name right? Well, the demo is not set-up that way -- 
there is no "Click here and I'll find the specific person who has 
this first and last name".


The demo is set up to search for first OR last name OR email address. 
It also provides a way to sort the records such that one can 
sequentially step any sort made on first-name/last-name; or 
last-name/first-name; or email address.


It only does what it says it does. Did you review the instructions at 
the bottom?


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] checkboxes

2009-04-23 Thread PJ
PJ wrote:
> tedd wrote:
>   
>> At 10:11 AM -0400 4/23/09, PJ wrote:
>> 
>>> tedd wrote:
>>>  > http://php1.net/a/edit-db-demo/
>>>   
  Here a user can search for a Last name, first name, or email. Note,
  there's no checkboxes because the user indicates what they are
  searching for by where they place their search criteria.

  HTH's

  tedd
 
>>> Thanks Tedd,
>>> Your demod uses javascript and I don't really want to use javascript.
>>> Apparently it is more open to hacking than just plain PHP/MySQL.  ??
>>> Also, I seem to have things going fairly well - it's a neat way to learn
>>> coding, especially when adjusting for things you hadn't planned in
>>> advance, like if the user forgets to enter data or doesn't click on the
>>> radio button. And then implementing the warnings and reloading (or not
>>> reloading the page) to keep the data entered upon omission or
>>> unacceptable entries. Get's hairy sometimes, but it's quite
>>> enlightening. ;-)
>>>   
>> Come-on, my demo uses a single javascript routine to ask the user IF
>> they want to delete something. If javascript is turned off, my demo
>> still works. This is just an example of enhancement with graceful
>> degradation. It has nothing to do with the demo other than that.
>>
>> The point of my showing you the demo was to simply suggest that you
>> forgo the checkboxes and go straight to the "Search" entry. After all,
>> that tells you everything you want to know about what the user wants
>> to do, right?
>>
>> Why have the user click a checkbox showing that they want to search
>> for a book title and then also have then enter in the book title? Why
>> not just have them enter the book title and be done with it?
>>
>> It might serve you well to rethink what you are wanting to do.
>>
>> Cheers,
>>
>> tedd
>>
>>
>> 
> Oh, Ok. Will check it out then. :-)  At worst, I'll set it up and see
> how it plays  ooh, well... another lesson to learn... ;-)
>
>   
H I've looked at your demo and, frankly, don't see it working.
When I enter names and click on one of the search buttons, I don't get
sane results. For instance, entering Johnson in last name and John in
first name, I click on search first name and I get an entry from page R
for first name John and Last name Raab. Doesn't make sense.
Anyway, I have my setup working using $_POST which gives me an array of
the inputs plus the submit string all in a one-dimensional array. Great.
Now I'm playing with how to set things up to eliminate extraneous inputs
which will be made, will, will not. So, filtering becomes rather
important and complicated.
I thought switch would work, but it doesn't look promising.
I can clear the 'submit' string by declaring $_POST['submit'] = ""; at
top of page; which seems strange??
But I can't figure out how to eliminate or avoid extraneous inputs. In
other words,
If I have input in the Search Title field and input in any one or all of
the other search options, clicking on Search Title the returned array
includes all options I'm not sure how to filter that. :-\
Is there some way to set the other inputs to null when choosing the
search? Without js?

-- 
unheralded genius: "A clean desk is the sign of a dull mind. "
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] checkboxes

2009-04-23 Thread PJ
PJ wrote:
> tedd wrote:
>   
>> At 10:11 AM -0400 4/23/09, PJ wrote:
>> 
>>> tedd wrote:
>>>  > http://php1.net/a/edit-db-demo/
>>>   
  Here a user can search for a Last name, first name, or email. Note,
  there's no checkboxes because the user indicates what they are
  searching for by where they place their search criteria.

  HTH's

  tedd
 
>>> Thanks Tedd,
>>> Your demod uses javascript and I don't really want to use javascript.
>>> Apparently it is more open to hacking than just plain PHP/MySQL.  ??
>>> Also, I seem to have things going fairly well - it's a neat way to learn
>>> coding, especially when adjusting for things you hadn't planned in
>>> advance, like if the user forgets to enter data or doesn't click on the
>>> radio button. And then implementing the warnings and reloading (or not
>>> reloading the page) to keep the data entered upon omission or
>>> unacceptable entries. Get's hairy sometimes, but it's quite
>>> enlightening. ;-)
>>>   
>> Come-on, my demo uses a single javascript routine to ask the user IF
>> they want to delete something. If javascript is turned off, my demo
>> still works. This is just an example of enhancement with graceful
>> degradation. It has nothing to do with the demo other than that.
>>
>> The point of my showing you the demo was to simply suggest that you
>> forgo the checkboxes and go straight to the "Search" entry. After all,
>> that tells you everything you want to know about what the user wants
>> to do, right?
>>
>> Why have the user click a checkbox showing that they want to search
>> for a book title and then also have then enter in the book title? Why
>> not just have them enter the book title and be done with it?
>>
>> It might serve you well to rethink what you are wanting to do.
>>
>> Cheers,
>>
>> tedd
>>
>>
>> 
> Oh, Ok. Will check it out then. :-)  At worst, I'll set it up and see
> how it plays  ooh, well... another lesson to learn... ;-)
>   
Gee, Tedd,
That was fun. You were right. It's a hell-of-a-lot simpler.
I did get the complicated way to work as well... :-D  but your
suggestion is much simpler.
The KISS principle always wins out! Thanks again.
Phil

-- 
unheralded genius: "A clean desk is the sign of a dull mind. "
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] checkboxes

2009-04-23 Thread PJ
tedd wrote:
> At 10:11 AM -0400 4/23/09, PJ wrote:
>> tedd wrote:
>>  > http://php1.net/a/edit-db-demo/
>>>
>>>  Here a user can search for a Last name, first name, or email. Note,
>>>  there's no checkboxes because the user indicates what they are
>>>  searching for by where they place their search criteria.
>>>
>>>  HTH's
>>>
>>>  tedd
>> Thanks Tedd,
>> Your demod uses javascript and I don't really want to use javascript.
>> Apparently it is more open to hacking than just plain PHP/MySQL.  ??
>> Also, I seem to have things going fairly well - it's a neat way to learn
>> coding, especially when adjusting for things you hadn't planned in
>> advance, like if the user forgets to enter data or doesn't click on the
>> radio button. And then implementing the warnings and reloading (or not
>> reloading the page) to keep the data entered upon omission or
>> unacceptable entries. Get's hairy sometimes, but it's quite
>> enlightening. ;-)
>
> Come-on, my demo uses a single javascript routine to ask the user IF
> they want to delete something. If javascript is turned off, my demo
> still works. This is just an example of enhancement with graceful
> degradation. It has nothing to do with the demo other than that.
>
> The point of my showing you the demo was to simply suggest that you
> forgo the checkboxes and go straight to the "Search" entry. After all,
> that tells you everything you want to know about what the user wants
> to do, right?
>
> Why have the user click a checkbox showing that they want to search
> for a book title and then also have then enter in the book title? Why
> not just have them enter the book title and be done with it?
>
> It might serve you well to rethink what you are wanting to do.
>
> Cheers,
>
> tedd
>
>
Oh, Ok. Will check it out then. :-)  At worst, I'll set it up and see
how it plays  ooh, well... another lesson to learn... ;-)

-- 
unheralded genius: "A clean desk is the sign of a dull mind. "
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] checkboxes

2009-04-23 Thread tedd

At 10:11 AM -0400 4/23/09, PJ wrote:

tedd wrote:
 > http://php1.net/a/edit-db-demo/


 Here a user can search for a Last name, first name, or email. Note,
 there's no checkboxes because the user indicates what they are
 searching for by where they place their search criteria.

 HTH's

 tedd

Thanks Tedd,
Your demod uses javascript and I don't really want to use javascript.
Apparently it is more open to hacking than just plain PHP/MySQL.  ??
Also, I seem to have things going fairly well - it's a neat way to learn
coding, especially when adjusting for things you hadn't planned in
advance, like if the user forgets to enter data or doesn't click on the
radio button. And then implementing the warnings and reloading (or not
reloading the page) to keep the data entered upon omission or
unacceptable entries. Get's hairy sometimes, but it's quite
enlightening. ;-)


Come-on, my demo uses a single javascript routine to ask the user IF 
they want to delete something. If javascript is turned off, my demo 
still works. This is just an example of enhancement with graceful 
degradation. It has nothing to do with the demo other than that.


The point of my showing you the demo was to simply suggest that you 
forgo the checkboxes and go straight to the "Search" entry. After 
all, that tells you everything you want to know about what the user 
wants to do, right?


Why have the user click a checkbox showing that they want to search 
for a book title and then also have then enter in the book title? Why 
not just have them enter the book title and be done with it?


It might serve you well to rethink what you are wanting to do.

Cheers,

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] checkboxes

2009-04-23 Thread PJ
tedd wrote:
> At 5:33 PM -0400 4/22/09, PJ wrote:
>> Well, I'm making a page to do limited searching of the database. To keep
>> it simple I just want to search by title, author,  ISBN or copyright
>> date. So, I need to input the user's choice, limit it to one of the
>> options and pass the supplied parameter to the query. I prefer to not
>> use Javascript. No need to disable stuff as that was merely a
>> misdirected thought. I think Ashley's suggestion should work. My problem
>> has been to understand the workings of the form inputs. Now, I'm just
>> anticipating some acrobatic feats to be able to pass the author
>> parameters to the query as they are comprised of two fields (first_name
>> and last_name). But, I think that that can be done, at worst, by doing a
>> different query just for the author.
>> TIA.
>> Phil
>
>
> Phil:
>
> The user has to enter something in to do a search right? So why not
> use what they enter as the type of search they what?
>
> Like so:
>
> http://php1.net/a/edit-db-demo/
>
> Here a user can search for a Last name, first name, or email. Note,
> there's no checkboxes because the user indicates what they are
> searching for by where they place their search criteria.
>
> HTH's
>
> tedd
Thanks Tedd,
Your demod uses javascript and I don't really want to use javascript.
Apparently it is more open to hacking than just plain PHP/MySQL.  ??
Also, I seem to have things going fairly well - it's a neat way to learn
coding, especially when adjusting for things you hadn't planned in
advance, like if the user forgets to enter data or doesn't click on the
radio button. And then implementing the warnings and reloading (or not
reloading the page) to keep the data entered upon omission or
unacceptable entries. Get's hairy sometimes, but it's quite
enlightening. ;-)

-- 
unheralded genius: "A clean desk is the sign of a dull mind. "
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] checkboxes

2009-04-23 Thread tedd

At 5:33 PM -0400 4/22/09, PJ wrote:

Well, I'm making a page to do limited searching of the database. To keep
it simple I just want to search by title, author,  ISBN or copyright
date. So, I need to input the user's choice, limit it to one of the
options and pass the supplied parameter to the query. I prefer to not
use Javascript. No need to disable stuff as that was merely a
misdirected thought. I think Ashley's suggestion should work. My problem
has been to understand the workings of the form inputs. Now, I'm just
anticipating some acrobatic feats to be able to pass the author
parameters to the query as they are comprised of two fields (first_name
and last_name). But, I think that that can be done, at worst, by doing a
different query just for the author.
TIA.
Phil



Phil:

The user has to enter something in to do a search right? So why not 
use what they enter as the type of search they what?


Like so:

http://php1.net/a/edit-db-demo/

Here a user can search for a Last name, first name, or email. Note, 
there's no checkboxes because the user indicates what they are 
searching for by where they place their search criteria.


HTH's

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] checkboxes

2009-04-22 Thread PJ
Lists wrote:
> PJ wrote:
>> How to deactivate checkboxes when one in a series is checked?
>> 
>> 
>> 
>> 
>> So that only 1 of the other inputs could be used in a search. Probably
>> do the rest with switch stuff.
>> Would be neat if the deactivated checkboxes would go grey.
>> Is this an HTML question? Use onclick?But I think I need to either use a
>> php string or function or would this be a CSS thingy?
>> Thanks for any help.
>
>
> I think you need to explain more precisely what you are doing.
>
> However, an appropriate use of client-side processing vs.
> server-side process is always a factor in a good web app.
>
> You *could* disable stuff via choices that are made with
> PHP, but it requires a submission of data. Javascript would
> allow you to disable certain things without a submission.
>
> First, I'd like to hear more clearly what end result you
> are going for.
Well, I'm making a page to do limited searching of the database. To keep
it simple I just want to search by title, author,  ISBN or copyright
date. So, I need to input the user's choice, limit it to one of the
options and pass the supplied parameter to the query. I prefer to not
use Javascript. No need to disable stuff as that was merely a
misdirected thought. I think Ashley's suggestion should work. My problem
has been to understand the workings of the form inputs. Now, I'm just
anticipating some acrobatic feats to be able to pass the author
parameters to the query as they are comprised of two fields (first_name
and last_name). But, I think that that can be done, at worst, by doing a
different query just for the author.
TIA.
Phil

-- 
unheralded genius: "A clean desk is the sign of a dull mind. "
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] checkboxes

2009-04-22 Thread Lists

PJ wrote:

How to deactivate checkboxes when one in a series is checked?




So that only 1 of the other inputs could be used in a search. Probably
do the rest with switch stuff.
Would be neat if the deactivated checkboxes would go grey.
Is this an HTML question? Use onclick?But I think I need to either use a
php string or function or would this be a CSS thingy?
Thanks for any help.



I think you need to explain more precisely what you are doing.

However, an appropriate use of client-side processing vs.
server-side process is always a factor in a good web app.

You *could* disable stuff via choices that are made with
PHP, but it requires a submission of data. Javascript would
allow you to disable certain things without a submission.

First, I'd like to hear more clearly what end result you
are going for.

Donovan


--
  =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o
  D. BROOKE   EUCA Design Center
   WebDNA Software Corp.
  WEB:> http://www.euca.us  |   http://www.webdna.us
  =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o
  WebDNA: [** Square Bracket Utopia **]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] checkboxes problem

2007-06-01 Thread Roberto Mansfield
Richard Lynch wrote:
> 
> On Wed, May 30, 2007 3:59 am, blueboy wrote:
>> Hi,
>>
>> I have a checkbox array (about 20 lines)
>>
>> input name=\"box\" type=\"checkbox\" value=\"$id\">
>> input name=\"box\" type=\"checkbox\" value=\"$id\">
>> input name=\"box\" type=\"checkbox\" value=\"$id\">
>>
>> I do some client side checking with javascript however the javascript
>> array
>>
>> name=\"box\"
>>
>> does not match the php version,
>>
>>  name=\"box[]\"
>>
>>  So either my client side stuff works or the php array only returns 1
>> value
>> when posted. Is there any way to for this to work?
> 
> Let PHP use the NAME= attribute, and JS use the ID= attribute
> 
> name="box[1]" id="box1"
> 

Another JS approach I found recently:

Rather than refer to the checkbox as document.form_name.box[] (which
fails in javascript), use: document.form_name['box[]'].

-Roberto

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] checkboxes problem

2007-05-30 Thread Richard Lynch


On Wed, May 30, 2007 3:59 am, blueboy wrote:
> Hi,
>
> I have a checkbox array (about 20 lines)
>
> input name=\"box\" type=\"checkbox\" value=\"$id\">
> input name=\"box\" type=\"checkbox\" value=\"$id\">
> input name=\"box\" type=\"checkbox\" value=\"$id\">
>
> I do some client side checking with javascript however the javascript
> array
>
> name=\"box\"
>
> does not match the php version,
>
>  name=\"box[]\"
>
>  So either my client side stuff works or the php array only returns 1
> value
> when posted. Is there any way to for this to work?

Let PHP use the NAME= attribute, and JS use the ID= attribute

name="box[1]" id="box1"

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] checkboxes problem

2007-05-30 Thread Zoltán Németh
2007. 05. 30, szerda keltezéssel 09.59-kor blueboy ezt írta:
> Hi,
> 
> I have a checkbox array (about 20 lines)
> 
> input name=\"box\" type=\"checkbox\" value=\"$id\">
> input name=\"box\" type=\"checkbox\" value=\"$id\">
> input name=\"box\" type=\"checkbox\" value=\"$id\">

input name=\"box[]\" type=\"checkbox\" value=\"$id\">

greets
Zoltán Németh

> 
> I do some client side checking with javascript however the javascript array
> 
> name=\"box\"
> 
> does not match the php version,
> 
>  name=\"box[]\"
> 
>  So either my client side stuff works or the php array only returns 1 value 
> when posted. Is there any way to for this to work?
> 
> 
> R.
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] checkboxes

2005-11-30 Thread Brent Baisley
Excellent response. You should always be expecting certain data. So  
if no checkboxes are checked, your code should realize that since it  
was expecting the data and none was submitted.
The "lazy way" is much easier to code, but it is actually fairly  
efficient. You are only hitting the database twice, once of the  
delete and once for the bulk insert. On a fixed record length table,  
the lazy way may actually be quicker.


On Nov 30, 2005, at 2:23 AM, Curt Zirzow wrote:


So we have a form that will eventually need to knnow  what values
should be selected. Potentially data alreadly exists that may have
the same records. There are two options (or perhaps more) to
approach this:

Decide as we go approach and clean up:

  1) Grap the 'vehicles' currently assoicated with the 'lot'
  2) if 'vehicle' is currently selected do nothing
  3) if 'vehicle' is a new item we should add 'vehicle' as long as it
 is a valid 'vehicle;
  4) repeat 2 and 3 until we looked at all the data
  5) figure out which ones should be deleted and delete them.


Forget everything, we'll add what is valid (the lazy way):

  1) delete every associated record to the 'lot'
  2) for each 'vehicle' add 'vehicle' as long as it is a valid
 'vehicle'



--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] checkboxes

2005-11-29 Thread Curt Zirzow
On Tue, Nov 29, 2005 at 10:15:36PM -0500, blackwater dev wrote:
> I have a form where I am dynamically building a bunch of checkbox
> inputs.  Then when submitted, I need to update the db.  Problem is, of
> course, if the checkbox is unchecked then the $_POST doesn't have the
> value in the array.  How can I get the value from $_POST even though
> it's unchecked?
> 
> For example, here would be the generated form:
> 
> Car 1
> Car 2
> Car 3
> Car 4
> 
> Then in the update I loop through:
> 
> foreach($_POST[cars] as $id=>$value){
> //update vehicles set value to yes or no
> 
> }

This is a good example on how *not* to trust data via form data
posted.  I'm assuming you have some sort of one to many relation
going on:

  table lot {
id int,
lot varchar(255)  -- Lot 1 
  }

  table vehicles {
id int,
name varchar(255) -- Car 1, Car 2, etc... 
  }

  table lotvehicle {
lot_id int,
vehicle_id int,
  }

The form value of cars[X] where X being the id of vehicle and the
value of 1 being it is selected (although with  the form definition
you just want to know if if cars[X] is defined.).

So we have a form that will eventually need to knnow  what values
should be selected. Potentially data alreadly exists that may have
the same records. There are two options (or perhaps more) to
approach this:

Decide as we go approach and clean up:

  1) Grap the 'vehicles' currently assoicated with the 'lot'
  2) if 'vehicle' is currently selected do nothing
  3) if 'vehicle' is a new item we should add 'vehicle' as long as it
 is a valid 'vehicle;
  4) repeat 2 and 3 until we looked at all the data
  5) figure out which ones should be deleted and delete them.


Forget everything, we'll add what is valid (the lazy way):

  1) delete every associated record to the 'lot'
  2) for each 'vehicle' add 'vehicle' as long as it is a valid
 'vehicle'


HTH,

Curt.
-- 
cat .signature: No such file or directory

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Checkboxes From Intersection Redux

2005-06-15 Thread Jack Jackson

That did it exactly, Kristen
Thanks so much for the help! (and sorry for sending this to you and not 
the list the first time!)




JJ

Kristen G. Thorson wrote:

Hopefully I understand your question correctly.

You have this SQL:

$media_query = 'SELECT media_id,media_name FROM media GROUP BY media_name';

And

"For every media_id which is associated with $cartoon in the table 
media_art, check the box; for all others leave them unchecked."


The problem is, the SQL you have is not returning every media_id 
(because you're grouping on media_name).  I wonder if you truly need to 
group on media_name.  I would assume that media_name is unique in the 
media table.   If it is not, then you need to rethink your table 
structure.  If you group on media_name and there are duplicate 
media_names, you can have data like this:


media_id media_name
4Name1
16   Name1

Grouping by media_name as in your query above will produce a line like:

media_idmedia_name
4   Name1

You then output this to check boxes and use those to set the relation to 
art and media.  But what's the difference between media_id 4 and 
media_id 16?  In this case, if the database always returns the group by 
this way, you would never set the media_id 16.  If there is a distinct 
difference between media_names with different ids, then I think you 
probably need to make some changes.


That being said, if you do not need to group by media_name, then you can 
simply do something like this:


select media.media_id, media.media_name, media_art.art_id, from media 
left join media_art on media_art.media_id=media.media_id and 
media_art.art_id=$cartoon['art_id']


Which would return a table like this if $cartoon['art_id']=15:

media_idmedia_name art_id
4   Name1  NULL
8   Name2  15
12  Name3  NULL
16  Name4  15
17  Name5  NULL
18  Name6  NULL

You could then test the output of art_id:

$checkbox_media[] = "value='{$media_rows['media_id']}' 
".(rows['art_id']==$cartoon['art_id']?" 
checked":"")."/>{$media_rows['media_name']}  ";



HTH
kgt





Jack Jackson wrote:


Hi,
With your help I got some checkboxes generated the other day for a 
form. I would like some help getting a similar problem solved.


I am now making a form to edit db entries made in the previous form. I 
have three tables involved: art, media and media_art. I need to show 
checkboxes for all available media. For the chosen record ($cartoon, 
which equals an art_id selected by the user) I must also go into the 
media_art table, and where the selected art ID has a corresponding 
media_id, display that media_id's media_name as a checked box.


TABLE media:
media_id   media_name
   1   ink
   2   pencil
   3   watercolor
   4   gauche
   5   watercolor pencil


To find out the art_id of the chosen record, the user is selecting 
from a dropdown box in the form. I'm doing queries like this to make a 
publisher dropdown in a similar vein:


$query = "SELECT * FROM art WHERE art.art_id = '$cartoon'";
$publisher_query = 'SELECT * FROM publisher';
$result = mysql_query($query);
$publisher_result = mysql_query($publisher_query);

while ($rows = mysql_fetch_assoc($result)){

 $publisher_dropdown = '';
while ($pub = mysql_fetch_assoc($publisher_result)){
$publisher_dropdown .= 'I now need to formulate how to make the checkboxes similarly. The 
original setup to make the checkboxes was :


$media_query = 'SELECT media_id,media_name FROM media GROUP BY 
media_name';

$media_result = mysql_query($media_query);

$checkbox_media = array ();
$media_types = array();
while ($media_rows = mysql_fetch_assoc($media_result)){
$checkbox_media[] = "name='media_types[]' value='{$media_rows['media_id']}' 
/>{$media_rows['media_name']}  ";

}

Those which were checked were inserted into media_art thusly:


media_id art_id
  31
  41
  51

What I want to do is say "For every media_id which is associated with 
$cartoon in the table media_art, check the box; for all others leave 
them unchecked.


How can I do this?
Thanks very much in advance,

Jack








--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Checkboxes From Intersection Redux

2005-06-15 Thread Kristen G. Thorson

Hopefully I understand your question correctly.

You have this SQL:

$media_query = 'SELECT media_id,media_name FROM media GROUP BY media_name';

And

"For every media_id which is associated with $cartoon in the table 
media_art, check the box; for all others leave them unchecked."


The problem is, the SQL you have is not returning every media_id 
(because you're grouping on media_name).  I wonder if you truly need to 
group on media_name.  I would assume that media_name is unique in the 
media table.   If it is not, then you need to rethink your table 
structure.  If you group on media_name and there are duplicate 
media_names, you can have data like this:


media_id media_name
4Name1
16   Name1

Grouping by media_name as in your query above will produce a line like:

media_idmedia_name
4   Name1

You then output this to check boxes and use those to set the relation to 
art and media.  But what's the difference between media_id 4 and 
media_id 16?  In this case, if the database always returns the group by 
this way, you would never set the media_id 16.  If there is a distinct 
difference between media_names with different ids, then I think you 
probably need to make some changes.


That being said, if you do not need to group by media_name, then you can 
simply do something like this:


select media.media_id, media.media_name, media_art.art_id, from media 
left join media_art on media_art.media_id=media.media_id and 
media_art.art_id=$cartoon['art_id']


Which would return a table like this if $cartoon['art_id']=15:

media_idmedia_name art_id
4   Name1  NULL
8   Name2  15
12  Name3  NULL
16  Name4  15
17  Name5  NULL
18  Name6  NULL

You could then test the output of art_id:

$checkbox_media[] = "value='{$media_rows['media_id']}' 
".(rows['art_id']==$cartoon['art_id']?" 
checked":"")."/>{$media_rows['media_name']}  "; 




HTH
kgt





Jack Jackson wrote:


Hi,
With your help I got some checkboxes generated the other day for a 
form. I would like some help getting a similar problem solved.


I am now making a form to edit db entries made in the previous form. I 
have three tables involved: art, media and media_art. I need to show 
checkboxes for all available media. For the chosen record ($cartoon, 
which equals an art_id selected by the user) I must also go into the 
media_art table, and where the selected art ID has a corresponding 
media_id, display that media_id's media_name as a checked box.


TABLE media:
media_id   media_name
   1   ink
   2   pencil
   3   watercolor
   4   gauche
   5   watercolor pencil


To find out the art_id of the chosen record, the user is selecting 
from a dropdown box in the form. I'm doing queries like this to make a 
publisher dropdown in a similar vein:


$query = "SELECT * FROM art WHERE art.art_id = '$cartoon'";
$publisher_query = 'SELECT * FROM publisher';

$result = mysql_query($query);

$publisher_result = mysql_query($publisher_query);

while ($rows = mysql_fetch_assoc($result)){

 $publisher_dropdown = '';
while ($pub = mysql_fetch_assoc($publisher_result)){
$publisher_dropdown .= 'I now need to formulate how to make the checkboxes similarly. The 
original setup to make the checkboxes was :


$media_query = 'SELECT media_id,media_name FROM media GROUP BY 
media_name';

$media_result = mysql_query($media_query);

$checkbox_media = array ();
$media_types = array();
while ($media_rows = mysql_fetch_assoc($media_result)){
$checkbox_media[] = "name='media_types[]' value='{$media_rows['media_id']}' 
/>{$media_rows['media_name']}  ";

}

Those which were checked were inserted into media_art thusly:


media_id art_id
  31
  41
  51

What I want to do is say "For every media_id which is associated with 
$cartoon in the table media_art, check the box; for all others leave 
them unchecked.


How can I do this?
Thanks very much in advance,

Jack



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Checkboxes

2003-08-15 Thread Chris Boget
> It could be a solution but only working with a few items. My list(s)
> will be filled up with hundreds of items grabbed automatically out of
> another MySQL table... would it help too? Maybe naming the check
> boxes with each item own ID... anyone?

What you could do is this:

$query = "SELECT field_name FROM table"
$result = mysql( $dbname, $query );

while( $dataRow = mysql_fetch_assoc( $result )) {
  echo '';

}

On submission, all your checboxes will be here:

$_POST['checkboxes']

and you can iterate through that to see what fields/checkboxes
were set.  No fuss, no muss and no billion if( isset( $checkbox )).

Chris


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Checkboxes

2003-08-15 Thread CPT John W. Holmes
You could name them as:



etc...

Then $_POST['choice'] will be an array of the boxes chosen.

$list = implode(',',$_POST['choice']);

will give you a comma separated list of all items chosen.

---John Holmes...

- Original Message - 
From: "Cesar Aracena" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 15, 2003 2:25 PM
Subject: [PHP] Checkboxes


Hi all,
 
I am wondering what would be the best way to handle checkboxes. I am
making a site that will display several items in a 20-items-per-page
format and each item will have a checkbox next to it for the user to
select them. Now, what I need to do is to record the items selected by
the user when clicking the "Next button" into a MySQL table. Should I
name all the checkboxes the same, using the item IDs as values and then
use an array to see which ones where selected or maybe another thing?
 
Thanks in advanced,
 
Cesar Aracena
  www.icaam.com.ar
Note: The information inside this message and also in the attached files
might be confidential. If you are not the desired receptor or the person
responsible of delivering the message, we notify you that it's copy,
distribution, keep or illegal use of the information it has it's
prohibited. Therefore we ask you to notify the sender by replying this
message immediately and then delete it from your computer.
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Checkboxes

2003-08-15 Thread Wouter van Vliet
I think I'd just use like






then you can loop through it with foreach($_POST[box] as $BoxID => $Value)
.. I assume the recieving script knows what boxes it expects?

-Oorspronkelijk bericht-
Van: Cesar Aracena [mailto:[EMAIL PROTECTED]
Verzonden: vrijdag 15 augustus 2003 20:38
Aan: [EMAIL PROTECTED]
Onderwerp: RE: [PHP] Checkboxes
Urgentie: Hoog


It could be a solution but only working with a few items. My list(s)
will be filled up with hundreds of items grabbed automatically out of
another MySQL table... would it help too? Maybe naming the checkboxes
with each item own ID... anyone?

Thanks,

Cesar Aracena
www.icaam.com.ar

> -Mensaje original-
> De: Matt Babineau [mailto:[EMAIL PROTECTED]
> Enviado el: Viernes, 15 de Agosto de 2003 12:34 p.m.
> Para: Cesar Aracena
> CC: [EMAIL PROTECTED]
> Asunto: Re: [PHP] Checkboxes
>
> You could try this:
>
> 
> 
>
> So basically when it get submitted, you'll have either a 0 or 1
response
> to know whether or not it has been checked.
>
> Does this help?
>
> Matt
>
> On Fri, 2003-08-15 at 14:25, Cesar Aracena wrote:
> > Hi all,
> >
> > I am wondering what would be the best way to handle checkboxes. I am
> > making a site that will display several items in a 20-items-per-page
> > format and each item will have a checkbox next to it for the user to
> > select them. Now, what I need to do is to record the items selected
by
> > the user when clicking the Next button into a MySQL table. Should I
> > name all the checkboxes the same, using the item IDs as values and
then
> > use an array to see which ones where selected or maybe another
thing?
> >
> > Thanks in advanced,
> >
> > Cesar Aracena
> >  <http://www.icaam.com.ar> www.icaam.com.ar
> > Note: The information inside this message and also in the attached
files
> > might be confidential. If you are not the desired receptor or the
person
> > responsible of delivering the message, we notify you that it's copy,
> > distribution, keep or illegal use of the information it has it's
> > prohibited. Therefore we ask you to notify the sender by replying
this
> > message immediately and then delete it from your computer.
> >




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Checkboxes

2003-08-15 Thread Cesar Aracena
It could be a solution but only working with a few items. My list(s)
will be filled up with hundreds of items grabbed automatically out of
another MySQL table... would it help too? Maybe naming the checkboxes
with each item own ID... anyone?

Thanks,

Cesar Aracena
www.icaam.com.ar

> -Mensaje original-
> De: Matt Babineau [mailto:[EMAIL PROTECTED]
> Enviado el: Viernes, 15 de Agosto de 2003 12:34 p.m.
> Para: Cesar Aracena
> CC: [EMAIL PROTECTED]
> Asunto: Re: [PHP] Checkboxes
> 
> You could try this:
> 
> 
> 
> 
> So basically when it get submitted, you'll have either a 0 or 1
response
> to know whether or not it has been checked.
> 
> Does this help?
> 
> Matt
> 
> On Fri, 2003-08-15 at 14:25, Cesar Aracena wrote:
> > Hi all,
> >
> > I am wondering what would be the best way to handle checkboxes. I am
> > making a site that will display several items in a 20-items-per-page
> > format and each item will have a checkbox next to it for the user to
> > select them. Now, what I need to do is to record the items selected
by
> > the user when clicking the Next button into a MySQL table. Should I
> > name all the checkboxes the same, using the item IDs as values and
then
> > use an array to see which ones where selected or maybe another
thing?
> >
> > Thanks in advanced,
> >
> > Cesar Aracena
> >  <http://www.icaam.com.ar> www.icaam.com.ar
> > Note: The information inside this message and also in the attached
files
> > might be confidential. If you are not the desired receptor or the
person
> > responsible of delivering the message, we notify you that it's copy,
> > distribution, keep or illegal use of the information it has it's
> > prohibited. Therefore we ask you to notify the sender by replying
this
> > message immediately and then delete it from your computer.
> >




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Checkboxes

2003-08-15 Thread Matt Babineau
You could try this:




So basically when it get submitted, you'll have either a 0 or 1 response
to know whether or not it has been checked.

Does this help?

Matt

On Fri, 2003-08-15 at 14:25, Cesar Aracena wrote:
> Hi all,
>  
> I am wondering what would be the best way to handle checkboxes. I am
> making a site that will display several items in a 20-items-per-page
> format and each item will have a checkbox next to it for the user to
> select them. Now, what I need to do is to record the items selected by
> the user when clicking the Next button into a MySQL table. Should I
> name all the checkboxes the same, using the item IDs as values and then
> use an array to see which ones where selected or maybe another thing?
>  
> Thanks in advanced,
>  
> Cesar Aracena
>   www.icaam.com.ar
> Note: The information inside this message and also in the attached files
> might be confidential. If you are not the desired receptor or the person
> responsible of delivering the message, we notify you that it's copy,
> distribution, keep or illegal use of the information it has it's
> prohibited. Therefore we ask you to notify the sender by replying this
> message immediately and then delete it from your computer.
>  


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Checkboxes

2003-03-14 Thread Hugh Danaher
In further thought on this, I'm not sure that $_POST['skill'] is an array.
Hugh
- Original Message -
From: "Stephen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 13, 2003 8:47 PM
Subject: [PHP] Checkboxes


> Hi
>
> I am trying to get results form checkboxes on a form.  Each checkbox is
> given a value of the id of an item in a table.  What I want to do is find
> out what is selected and from there get the id so I can create a sql
insert
> statement for each selected item.
>
> I can get the item selected but not a value.
> I am using:
>
> PHP:
>
> if (count($_POST['skill'])>0) {
>  for  ($i=0;$i   echo "$fskill[$i]\n";
>  }
> }
>
> inside a form
> 
> 
> 
>
> I get a number of bullets representing the items I check but no value!
>
> Thanks,
>
> Stephen
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Checkboxes

2003-03-14 Thread Hugh Danaher
The following is completely untested but might yield the results you want.
It assigns a value to the skill array, prints the post var, and then (I
hope) advances the array pointer to the next array element:
Good luck, hugh

if (count($_POST['skill'])>0)
{
for  ($i=0;$i".$_POST['skill']."\n";
next($_POST['skill']);  // should advance the pointer to the
next element in the array
}
> }
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Checkboxes

2003-03-13 Thread John W. Holmes
> I am trying to get results form checkboxes on a form.  Each checkbox
is
> given a value of the id of an item in a table.  What I want to do is
find
> out what is selected and from there get the id so I can create a sql
> insert
> statement for each selected item.
> 
> I can get the item selected but not a value.
> I am using:
> 
> PHP:
> 
> if (count($_POST['skill'])>0) {
>  for  ($i=0;$i   echo "$fskill[$i]\n";
>  }
> }
> 
> inside a form
> 
> 
> 
> 
> I get a number of bullets representing the items I check but no value!

What is $fskill? Did you forget to update your code?

echo "{$_POST['skill'][$i]}\n";

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] checkboxes and php...

2003-01-31 Thread Matt Schroebel
> -Original Message-
> From: Mr. BuNgL3 [mailto:[EMAIL PROTECTED]] 
> Sent: Friday, January 31, 2003 8:43 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] checkboxes and php...
> 
> 
> Hi...
> can you give me some lights in this subject? How checkboxes 
> work with php?
> Or where i can find some info about this? Or both :)
> Ex: if i want to erase from db all data with the checkbox active...

Search the archives ...
http://marc.theaimsgroup.com/?l=php-general&w=2&r=1&s=checkbox&q=b


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] checkboxes & php

2003-01-24 Thread Richard Whitney
Quoting Chris Boget <[EMAIL PROTECTED]>:

### >  applies to selection lists, not checkboxes
### 
### Indeed.  But I believe he was offering that as an alternative. :)

Ahem!  Thanks Chris!

RW

### Chris
### 
### 
### -- 
### PHP General Mailing List (http://www.php.net/)
### To unsubscribe, visit: http://www.php.net/unsub.php
### 
### 


-- 
Richard Whitney
Transcend Development
Producing the next phase of your internet presence.
[EMAIL PROTECTED]
http://xend.net
602-971-2791

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] checkboxes & php

2003-01-24 Thread Chris Boget
>  applies to selection lists, not checkboxes

Indeed.  But I believe he was offering that as an alternative. :)

Chris


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] checkboxes & php

2003-01-24 Thread Rick Emery
 applies to selection lists, not checkboxes
- Original Message - 
From: "Richard Whitney" <[EMAIL PROTECTED]>
To: "Greg" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, January 24, 2003 2:59 PM
Subject: Re: [PHP] checkboxes & php


I just logged in to my Yahoo mail account.  I have only one account, but when I
went to Preferences, it had a , which you might want to consider

RW

Quoting Greg <[EMAIL PROTECTED]>:

### I want to be able to let people check multiple values.  I want them to be
### given a list of usernames and check the ones they want deleted, so a
### radio
### button won't work.  If you go to Yahoo mail and select more than one
### checkbox, you can delete more than one item.  I looked at the source and
### all
### the checkboxes are called "Mid".  Any ideas?
### /Greg
### 
### 
### "Edward Peloke" <[EMAIL PROTECTED]> wrote in message
### [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
### > why would you give them all the same name?  I can see this for radio
### buttons
### > but not checkboxes.
### >
### > -Original Message-
### > From: Greg [mailto:[EMAIL PROTECTED]]
### > Sent: Friday, January 24, 2003 3:27 PM
### > To: [EMAIL PROTECTED]
### > Subject: [PHP] checkboxes & php
### >
### >
### > If I have 3 checkboxes labeled "user", but each one has a seperate
### value,
### > how do I get the values of each checkbox?  For example, how would I
### tell
### if
### > the following checkboxes are checked?
### >
### > 
### > 
### > 
### > 
### >
### >
### >
### > --
### > PHP General Mailing List (http://www.php.net/)
### > To unsubscribe, visit: http://www.php.net/unsub.php
### >
### >
### 
### 
### 
### -- 
### PHP General Mailing List (http://www.php.net/)
### To unsubscribe, visit: http://www.php.net/unsub.php
### 
### 


-- 
Richard Whitney
Transcend Development
Producing the next phase of your internet presence.
[EMAIL PROTECTED]
http://xend.net
602-971-2791

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] checkboxes & php

2003-01-24 Thread Richard Whitney
I just logged in to my Yahoo mail account.  I have only one account, but when I
went to Preferences, it had a , which you might want to consider

RW

Quoting Greg <[EMAIL PROTECTED]>:

### I want to be able to let people check multiple values.  I want them to be
### given a list of usernames and check the ones they want deleted, so a
### radio
### button won't work.  If you go to Yahoo mail and select more than one
### checkbox, you can delete more than one item.  I looked at the source and
### all
### the checkboxes are called "Mid".  Any ideas?
### /Greg
### 
### 
### "Edward Peloke" <[EMAIL PROTECTED]> wrote in message
### [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
### > why would you give them all the same name?  I can see this for radio
### buttons
### > but not checkboxes.
### >
### > -Original Message-
### > From: Greg [mailto:[EMAIL PROTECTED]]
### > Sent: Friday, January 24, 2003 3:27 PM
### > To: [EMAIL PROTECTED]
### > Subject: [PHP] checkboxes & php
### >
### >
### > If I have 3 checkboxes labeled "user", but each one has a seperate
### value,
### > how do I get the values of each checkbox?  For example, how would I
### tell
### if
### > the following checkboxes are checked?
### >
### > 
### > 
### > 
### > 
### >
### >
### >
### > --
### > PHP General Mailing List (http://www.php.net/)
### > To unsubscribe, visit: http://www.php.net/unsub.php
### >
### >
### 
### 
### 
### -- 
### PHP General Mailing List (http://www.php.net/)
### To unsubscribe, visit: http://www.php.net/unsub.php
### 
### 


-- 
Richard Whitney
Transcend Development
Producing the next phase of your internet presence.
[EMAIL PROTECTED]
http://xend.net
602-971-2791

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] checkboxes & php

2003-01-24 Thread Didier McGillis
Then I would do what John Holmes suggested.

---John Holmes...

Or name them as an array, "user[]" so that you have a $_REQUEST['user']
array. Checkboxes are a little pecular in how they come across into PHP. If
you search the archives you'll get some good examples.

---John Holmes...







From: "Greg" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Re: [PHP] checkboxes & php
Date: Fri, 24 Jan 2003 15:37:06 -0500

I want to be able to let people check multiple values.  I want them to be
given a list of usernames and check the ones they want deleted, so a radio
button won't work.  If you go to Yahoo mail and select more than one
checkbox, you can delete more than one item.  I looked at the source and 
all
the checkboxes are called "Mid".  Any ideas?
/Greg


"Edward Peloke" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> why would you give them all the same name?  I can see this for radio
buttons
> but not checkboxes.
>
> -Original Message-
> From: Greg [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 24, 2003 3:27 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] checkboxes & php
>
>
> If I have 3 checkboxes labeled "user", but each one has a seperate 
value,
> how do I get the values of each checkbox?  For example, how would I tell
if
> the following checkboxes are checked?
>
> 
> 
> 
> 
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


_
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*   
http://join.msn.com/?page=features/junkmail


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] checkboxes & php

2003-01-24 Thread Greg
Ah, that's exactly what I was looking for.  Thanks!  I had the right PHP
code, just didn't have the right html :)
/Greg
"1lt John W. Holmes" <[EMAIL PROTECTED]> wrote in message
00a201c2c3e8$6e2431d0$a629089b@TBHHCCDR">news:00a201c2c3e8$6e2431d0$a629089b@TBHHCCDR...
> Or name them as an array, "user[]" so that you have a $_REQUEST['user']
> array. Checkboxes are a little pecular in how they come across into PHP.
If
> you search the archives you'll get some good examples.
>
> ---John Holmes...
>
> - Original Message -
> From: "Richard Whitney" <[EMAIL PROTECTED]>
> To: "Greg" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Friday, January 24, 2003 3:31 PM
> Subject: Re: [PHP] checkboxes & php
>
>
> > You need to give the checkboxes unique names like user1, user2 user3
> >
> > RW
> >
> > Quoting Greg <[EMAIL PROTECTED]>:
> >
> > ### If I have 3 checkboxes labeled "user", but each one has a seperate
> value,
> > ### how do I get the values of each checkbox?  For example, how would I
> tell
> > ### if
> > ### the following checkboxes are checked?
> > ###
> > ### 
> > ### 
> > ### 
> > ### 
> > ###
> > ###
> > ###
> > ### --
> > ### PHP General Mailing List (http://www.php.net/)
> > ### To unsubscribe, visit: http://www.php.net/unsub.php
> > ###
> > ###
> >
> >
> > --
> > Richard Whitney
> > Transcend Development
> > Producing the next phase of your internet presence.
> > [EMAIL PROTECTED]
> > http://xend.net
> > 602-971-2791
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] checkboxes & php

2003-01-24 Thread Greg
I want to be able to let people check multiple values.  I want them to be
given a list of usernames and check the ones they want deleted, so a radio
button won't work.  If you go to Yahoo mail and select more than one
checkbox, you can delete more than one item.  I looked at the source and all
the checkboxes are called "Mid".  Any ideas?
/Greg


"Edward Peloke" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> why would you give them all the same name?  I can see this for radio
buttons
> but not checkboxes.
>
> -Original Message-
> From: Greg [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 24, 2003 3:27 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] checkboxes & php
>
>
> If I have 3 checkboxes labeled "user", but each one has a seperate value,
> how do I get the values of each checkbox?  For example, how would I tell
if
> the following checkboxes are checked?
>
> 
> 
> 
> 
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] checkboxes & php

2003-01-24 Thread 1LT John W. Holmes
Or name them as an array, "user[]" so that you have a $_REQUEST['user']
array. Checkboxes are a little pecular in how they come across into PHP. If
you search the archives you'll get some good examples.

---John Holmes...

- Original Message -
From: "Richard Whitney" <[EMAIL PROTECTED]>
To: "Greg" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, January 24, 2003 3:31 PM
Subject: Re: [PHP] checkboxes & php


> You need to give the checkboxes unique names like user1, user2 user3
>
> RW
>
> Quoting Greg <[EMAIL PROTECTED]>:
>
> ### If I have 3 checkboxes labeled "user", but each one has a seperate
value,
> ### how do I get the values of each checkbox?  For example, how would I
tell
> ### if
> ### the following checkboxes are checked?
> ###
> ### 
> ### 
> ### 
> ### 
> ###
> ###
> ###
> ### --
> ### PHP General Mailing List (http://www.php.net/)
> ### To unsubscribe, visit: http://www.php.net/unsub.php
> ###
> ###
>
>
> --
> Richard Whitney
> Transcend Development
> Producing the next phase of your internet presence.
> [EMAIL PROTECTED]
> http://xend.net
> 602-971-2791
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] checkboxes & php

2003-01-24 Thread Richard Whitney
Do you, prehaps, wants to use radio buttons instead?

RW

Quoting Greg <[EMAIL PROTECTED]>:

### If I have 3 checkboxes labeled "user", but each one has a seperate value,
### how do I get the values of each checkbox?  For example, how would I tell
### if
### the following checkboxes are checked?
### 
### 
### 
### 
### 
### 
### 
### 
### -- 
### PHP General Mailing List (http://www.php.net/)
### To unsubscribe, visit: http://www.php.net/unsub.php
### 
### 


-- 
Richard Whitney
Transcend Development
Producing the next phase of your internet presence.
[EMAIL PROTECTED]
http://xend.net
602-971-2791

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] checkboxes & php

2003-01-24 Thread Richard Whitney
You need to give the checkboxes unique names like user1, user2 user3

RW

Quoting Greg <[EMAIL PROTECTED]>:

### If I have 3 checkboxes labeled "user", but each one has a seperate value,
### how do I get the values of each checkbox?  For example, how would I tell
### if
### the following checkboxes are checked?
### 
### 
### 
### 
### 
### 
### 
### 
### -- 
### PHP General Mailing List (http://www.php.net/)
### To unsubscribe, visit: http://www.php.net/unsub.php
### 
### 


-- 
Richard Whitney
Transcend Development
Producing the next phase of your internet presence.
[EMAIL PROTECTED]
http://xend.net
602-971-2791

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] checkboxes & php

2003-01-24 Thread Edward Peloke
why would you give them all the same name?  I can see this for radio buttons
but not checkboxes.

-Original Message-
From: Greg [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 24, 2003 3:27 PM
To: [EMAIL PROTECTED]
Subject: [PHP] checkboxes & php


If I have 3 checkboxes labeled "user", but each one has a seperate value,
how do I get the values of each checkbox?  For example, how would I tell if
the following checkboxes are checked?








--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] checkboxes, radio buttons and $_POST['']

2003-01-09 Thread Tom Rogers
Hi,

Friday, January 10, 2003, 4:25:00 AM, you wrote:
JEO> Hi

JEO> HELP!!!

JEO> I have read through the manual about using $_POST[''] to retrieve 
JEO> data from forms, but what happens when a form element is not filled in 
JEO> or checked?

JEO> If I have a checkbox on a form called "chk1" I get an error from PHP 
JEO> when I try this:
JEO> $chk1 = $_POST['chk1'];  // error if user did not chech the checkbox on 
JEO> the form!!!

JEO> How do ya usefully retrieve the fact that a form element has not been 
JEO> filled in/checked?

JEO> Be Well,

JEO> John-Erik Omland

JEO> 

JEO> "Rhythm is the basis of life,
JEO>  not steady forward progress.
JEO> The forces of creation,  destruction, and preservation
JEO>   have a whirling, dynamic interaction."
JEO>     - Kabbalah

Do it like this:

$chk1 = (isset($_POST['chk1']))? $_POST['chk1'] : 'No';

replace 'No' with whatever you want for an unchecked box

-- 
regards,
Tom


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] checkboxes, radio buttons and $_POST['']

2003-01-09 Thread Marek Kilimajer
In the php.ini file set error reporting to E_ALL & ~E_NOTICE
	-- Joseph W. Goff



Seems like register_globals issue has been replaced by error_reporting ;-)

John-Erik Omland wrote:


Hi

HELP!!!

I have read through the manual about using $_POST[''] to 
retrieve data from forms, but what happens when a form element is not 
filled in or checked?

If I have a checkbox on a form called "chk1" I get an error from PHP 
when I try this:
$chk1 = $_POST['chk1'];  // error if user did not chech the checkbox 
on the form!!!

How do ya usefully retrieve the fact that a form element has not been 
filled in/checked?

Be Well,

John-Erik Omland



"Rhythm is the basis of life,
not steady forward progress.
The forces of creation,  destruction, and preservation
 have a whirling, dynamic interaction."
- Kabbalah



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] checkboxes, radio buttons and $_POST['']

2003-01-09 Thread Tim Ward
isset($_POST["chk1"]) will only be true if the checkbox is checked.


Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message - 
From: John-Erik Omland <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 09, 2003 6:25 PM
Subject: [PHP] checkboxes, radio buttons and $_POST['']


Hi

HELP!!!

I have read through the manual about using $_POST[''] to retrieve 
data from forms, but what happens when a form element is not filled in 
or checked?

If I have a checkbox on a form called "chk1" I get an error from PHP 
when I try this:
$chk1 = $_POST['chk1'];  // error if user did not chech the checkbox on 
the form!!!

How do ya usefully retrieve the fact that a form element has not been 
filled in/checked?

Be Well,

John-Erik Omland



"Rhythm is the basis of life,
 not steady forward progress.
The forces of creation,  destruction, and preservation
  have a whirling, dynamic interaction."
- Kabbalah



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] checkboxes

2002-11-22 Thread Ernest E Vogelsinger
At 12:16 22.11.2002, empty spoke out and said:
[snip]
>...
>
>  AAA
>
>
>  SSS
>
>...
>
>and the PHP code:
>
>$eval='';
>if(isset($val)){
>   if(isset($val[0]) && isset($val[1])) $eval="as";
>   if(isset($val[0]) && !isset($val[1])) $eval="a";
>   if(!isset($val[0]) && isset($val[1])) $eval="s";
>
>$sql="insert into maillist (ID, postmeth) values ('$id_no','$eval')";
>$result=mysql_query($sql);
>if(!$result) echo("ERROR");
>}
>
[snip] 

Hi,

1) like Bastian already pointed out, you need to name your checkboxes
"val[]" in order to have PHP recognize them being an array.

2) You cannot use "isset($val[0])" and "isset($val[1])". If any checkbox is
clicked, $val[0] will always be set. If only one is clicked (regardless
which one) index 0 will be set and index 1 unset.

Instead, you should
  if(is_array($val)){
  if (in_array('a', $val) && in_array('s', $val)) $eval='as';
  elseif (in_array('a', $val))$eval='a';
  elseif (in_array('s', $val))$eval='s';

However this would give you the very same result, but much more elegant:
   $eval = join('', $val);
And it will automatically handle all further additions when $val[] might
have more possible values except 'a' and 's'.


-- 
   >O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
^ http://www.vogelsinger.at/



RE: [PHP] checkboxes and selection lists

2002-11-04 Thread Brendon G
I use the following function for my check boxes in forms in PHP.

Putting your form element creation into functions or even classes makes life
so much easier when you have to validate / change code.

you'll be glad you did it

Cheers

Brendon



function fncwriteformcheckbox($strname, $strid, $strvalue, $varcheckedvalue)
{
/*
 fncWriteFormCheckbox
 Returns HTML for a  element
 Accepts form element name as string
 Accepts form element ID as string
 Accepts form element value as string
 Accepts form element checked value as string or array.
 If checked value = default value then "checked" is written
 to the HTML stream

 Adapted from ASP functions by Ken Schaefer.
*/
define("PROC", "fncwriteformcheckbox");
$strtemp = "
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 05, 2002 5:06 PM
Subject: [PHP] checkboxes and selection lists


Hi, as a beginner I find the way you declare variables through HTML-forms
quite straightforward. But the reverse, to put the same variables back into
a form field is not so obvious for selection lists and checkboxes.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] checkboxes and selection lists

2002-11-04 Thread rija
If you have hundred thousand elements for example if you rob up for some
country select within tierce code-

I thinks doing like the following is better

echo "
a
b
...
zz
$value

" ;

And I don't care if it could have 2 same value in the select case...

And if there aren't many value, I think the following  sounds better:

echo "

A
B
C
" ;



- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 05, 2002 5:06 PM
Subject: [PHP] checkboxes and selection lists


Hi, as a beginner I find the way you declare variables through HTML-forms
quite straightforward. But the reverse, to put the same variables back into
a form field is not so obvious for selection lists and checkboxes. Would for
instance this be the best way:


>A
>B
>C


or would there be something more elegant?

Thanks, Marco




Internet wordt pas leuk als je mee kunt doen. Ga naar http://www.hetnet.nl

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





Re: [PHP] checkboxes and selection lists

2002-11-04 Thread John Nichel
For something like this, instead of doing all the HTML, I would set up 
and array, and then loop through the array to output the HTML...




for ( $i = 0; $qual_array[$i]; $i++ ) {
	if ( $_POST['qual'] == $qual_array[$i] ) {
		echo ( "" . 
$qual_array[$i] . "\n" );
	} else {
		echo ( "" . $qual_array[$i] 
. "\n" );
	}
}

?>


[EMAIL PROTECTED] wrote:
Hi, as a beginner I find the way you declare variables through HTML-forms quite straightforward. But the reverse, to put the same variables back into a form field is not so obvious for selection lists and checkboxes. Would for instance this be the best way:

	
		>A
		>B
		>C
	

or would there be something more elegant?

Thanks, Marco



Internet wordt pas leuk als je mee kunt doen. Ga naar http://www.hetnet.nl





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] checkboxes / form elements

2002-07-12 Thread Alberto Serra

ðÒÉ×ÅÔ!

Analysis & Solutions wrote:
> On Fri, Jul 12, 2002 at 10:59:00PM -0400, Blue Presley wrote:
> 
>>Hello.  I have a form that I would like to use checkboxes.
>>... snip ...
>>I've been told that if I want to manipulate each
>>one then I should use 'name=checkbox[]' and make an array out of it.  okay,
>>fine.  but how do i access them in my PHP script? I know I have to use the
>>$_POST[] array, but this creates a multidiminsional array, yes? do i access
>>it like $_POST[checkbox[1]]?? or $_POST[checkbox][1]??
> 
> 
> The latter.  But note, if a box isn't checked, it's not going to be 
> sent, so won't be in the array.
> 
>
> NV
> NH
> NJ
>
> 
> In this case $_POST['checkbox'][0] would be 33 and ...[1] would be 34.
> 
> Sometimes it's handy to identify the key upfront:
> 
>
> NV
> NH
> NJ
>
> 
> That would yield $_POST['checkbox']['34'] = 40.
> 
> A nice way to handle incomming checkboxes is this:
> 
>while ( list($Key, $Val) = each($checkbox) ) {
>   #  do what you need to do...
>   #  for example, show what was sent...
>   echo "$Key = $Val\n";
>}

Just one thing, as someone noted a week ago or so, you can't use the [] 
syntax *and* javascript. If you also need to process your checks from 
jscript side you shall resort to some older method and have your 
variables called like

 NV
 NV

then process it with variable variable names (the $$ syntax).

ÐÏËÁ
áÌØÂÅÒÔÏ
ëÉÅ×

@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@

LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu?
lOrD i'M sHiNiNg...
YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE
tHe TeSt, YeS iT iS
ThE tEsT, yEs It Is
tHe TeSt, YeS iT iS
ThE tEsT, yEs It Is...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] checkboxes / form elements

2002-07-12 Thread Analysis & Solutions

On Fri, Jul 12, 2002 at 10:59:00PM -0400, Blue Presley wrote:
> Hello.  I have a form that I would like to use checkboxes.
> ... snip ...
> I've been told that if I want to manipulate each
> one then I should use 'name=checkbox[]' and make an array out of it.  okay,
> fine.  but how do i access them in my PHP script? I know I have to use the
> $_POST[] array, but this creates a multidiminsional array, yes? do i access
> it like $_POST[checkbox[1]]?? or $_POST[checkbox][1]??

The latter.  But note, if a box isn't checked, it's not going to be 
sent, so won't be in the array.

   
NV
NH
NJ
   

In this case $_POST['checkbox'][0] would be 33 and ...[1] would be 34.

Sometimes it's handy to identify the key upfront:

   
NV
NH
NJ
   

That would yield $_POST['checkbox']['34'] = 40.

A nice way to handle incomming checkboxes is this:

   while ( list($Key, $Val) = each($checkbox) ) {
  #  do what you need to do...
  #  for example, show what was sent...
  echo "$Key = $Val\n";
   }

Enjoy,

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] checkboxes / form elements

2002-07-12 Thread John Holmes

> Hello.  I have a form that I would like to use checkboxes.  these
> checkboxes
> are created dynamically.  I've been told that if I want to manipulate
each
> one then I should use 'name=checkbox[]' and make an array out of it.
> okay,
> fine.  but how do i access them in my PHP script? I know I have to use
the
> $_POST[] array, but this creates a multidiminsional array, yes? do i
> access
> it like $_POST[checkbox[1]]?? or $_POST[checkbox][1]??

Yes, the second one, only with single quotes.

$_POST['checkbox][1]

Note that arrays start at zero, too.

---John Holmes...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] checkboxes

2002-06-22 Thread David Freeman


 > I know this might be a bit easy for all you experts out 
 > there.  I have multiple checkboxes and text areas in a form.  In the 
 > confirmation email sent to the user I manage to get the text areas to
display 
 > in the email. How would I get the results of the  checkboxes to to
display as well?

Here is a page I wrote to explore form processing.  It has a simple form
on it that includes each type of form element (except file upload) and
displays back all input.  It can also be used as a form target and it
will tell you what form elements were submitted.

It was written some time ago and I haven't updated it for the latest
version of PHP so it will most likely require register_globals to be on.

-8<-


OQI - CGI Reflector



CGI
Reflector\n";
echo "\n";
echo "Here are the results of the form that you have just
submitted:\n";
echo "\n";

echo "\n";
echo "\n";
echo "\n";
echo "Form Input
Name\n";
echo "\n";
echo "Form Input
Data\n";
echo "\n";
echo "\n";
while(list($key, $val) = each($HTTP_POST_VARS))
{
echo "\n";
echo "\n";
echo "$key\n";
echo "\n";
if (is_array($val))
{
while(list($sval) = each($val))
{
echo "$sval\n";
}
} else {
echo "$val\n";
}
echo "\n";
echo "\n";
}
echo "\n";
} else {
echo "CGI
Reflector\n";
?>





Test Form



Text





Select


First Option
Second Option
Third Option




Multi-Select


First Option
Second Option
Third Option
Fourth Option
Fifth Option




Check Box

Check Box
1
Check Box
2



Radio Button

Radio
Button 1
Radio
Button 2



Text Area

Default
Text














8<-



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] CheckBoxes....

2002-03-07 Thread Kearns, Terry

Don't name the checkboxes all the same, instead:

Option1 
Option2 
Option3 


Then handle it with

function getCheckboxResults($prefix=FALSE)
{
global $_POST ;
$results = NULL ; // needed for 'return' in case no items (v4.1.x)
if(is_string($prefix)){
For($i=0;$i<=count($_POST);$i++){
if(isset($_POST[$prefix.$i])) $results[] = $i ;
}
} else { return -1 ; } // throw exception in script
return $results ;
}

$selectedCKItems = getCheckboxResults('ck');
if(!$selectedCKItems) makeError('Please select at least one item.');

If a checkbox is not selected, the CGI will drop it (as in, not pass on the
name/value pair - meaning the name is not there - which is why you test for
it's existance).

I didn't test that example. But if it works, the function might be a nice
addition to your (and mine) library :)


you might use it like to:
$prefix = 'ck';
Forech($arrLabels AS $i=>$label)
printf('%s \n',$label,$prefix,$i);

Then put this member functions in a class deinition and register instatiated
objects with a session to use them across pages. $arrLabels would be a
property of the class. 'ck' would be the value of another property. Maybe
your foreach statement was in a member function.

OK, I'll shut up now :)

[TK] 





> -Original Message-
> From: Erik Price [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, 5 March 2002 2:24 AM
> To: bvr
> Cc: Ben Turner; [EMAIL PROTECTED]
> Subject: Re: [PHP] CheckBoxes
> 
> 
> 
> On Sunday, March 3, 2002, at 11:15  AM, bvr wrote:
> 
> > If you append '[]' to the name, an array will be returned 
> after submit
> > with the values of the checked checkboxes.
> >
> 
> 
> Is there any other way of doing this?  Using the brackets at 
> the end of 
> the input's name is super-convenient, making it relatively 
> easy to work 
> with arrays and user input in PHP.  I love that.  But I also wish I 
> could validate my pages as XHTML Strict.  I know it's not 
> really a big 
> deal, it's just a pride-in-work thing.
> 
> Alternatively, is there any plans to change the DTD for XHTML 
> Strict to 
> allow brackets?  IMO it's not something that cause problems 
> if it were 
> to be supported.  Kind of lame that it's not, actually.
> 
> Until then, I'll keep using them (brackets) b/c there's some 
> things that 
> it seems I can't do without this technique, but it would be nice
> 
> 
> Erik
> 
> 
> 
> 
> 
> 
> Erik Price
> Web Developer Temp
> Media Lab, H.H. Brown
> [EMAIL PROTECTED]
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] CheckBoxes....

2002-03-04 Thread Erik Price


On Monday, March 4, 2002, at 10:37  AM, Jon Haworth wrote:

> Subscribe to the www-html list at w3.org and ask the guys who look after
> this sort of thing if it's a possibility. Realistically, no-one will be
> prepared to rework the DTDs that already exist, but it might be 
> something
> that's worth bringing up in case it makes it into the next version.

Too many mailing lists already!  :)  I will look into making a 
suggestion to the W3, however.  Thanks for your reply (just curious if 
this had already been dealt with yet).


Erik





Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] CheckBoxes....

2002-03-04 Thread Jon Haworth

> Alternatively, is there any plans to change the DTD for 
> XHTML Strict to allow brackets?  IMO it's not something 
> that cause problems if it were to be supported.  Kind of 
> lame that it's not, actually.

Subscribe to the www-html list at w3.org and ask the guys who look after
this sort of thing if it's a possibility. Realistically, no-one will be
prepared to rework the DTDs that already exist, but it might be something
that's worth bringing up in case it makes it into the next version.

Cheers
Jon

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] CheckBoxes....

2002-03-04 Thread Erik Price


On Sunday, March 3, 2002, at 11:15  AM, bvr wrote:

> If you append '[]' to the name, an array will be returned after submit 
> with the values of the checked checkboxes.
>


Is there any other way of doing this?  Using the brackets at the end of 
the input's name is super-convenient, making it relatively easy to work 
with arrays and user input in PHP.  I love that.  But I also wish I 
could validate my pages as XHTML Strict.  I know it's not really a big 
deal, it's just a pride-in-work thing.

Alternatively, is there any plans to change the DTD for XHTML Strict to 
allow brackets?  IMO it's not something that cause problems if it were 
to be supported.  Kind of lame that it's not, actually.

Until then, I'll keep using them (brackets) b/c there's some things that 
it seems I can't do without this technique, but it would be nice


Erik






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] CheckBoxes....

2002-03-03 Thread bvr


Yes, well, PHP supports that a little bit differently.

If you append '[]' to the name, an array will be returned after submit 
with the values of the checked checkboxes.





(submit..)

$test now contains array("1","3");


bvr.


Ben Turner wrote:

>Don't checkboxes, if you name them all the same name, produce a comma delimited 
>string in php of the values selected???
>
>such as for 15 checkboxes with numeric values would produce a string such as
>
>,,,1314,,,18
>
>when the form was submited??  This is the way it was handled in ASP... is there 
>something different for PHP?
>
>thanks!
>Ben
>






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] CheckBoxes....

2002-03-02 Thread Ben Turner

The form i am filling with the checkboxes has several checkbox options that
someone can select subscription types.  The sub types are all generated from
a result set so that the form can grow or shrink by what is in the database
and not by what is on the html code Trying to accomplish this with hand
off maintenace.  When a new option becomes available, add the option to the
db and all the work is done.  the php and the html code doesnt need to be
modified at all

Oh I hope this can be accomplished




- Original Message -
From: "Jeff Sheltren" <[EMAIL PROTECTED]>
To: "Ben Turner" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, March 02, 2002 10:25 PM
Subject: Re: [PHP] CheckBoxes


> As far as I know, you can't name different checkboxes with the same name
> (seems odd to me to do this anyway...).  When you submit a form to a php
> page, the php page will have a variable for each input item in your
> form.  So if you have checkbox items named, "a", "b", "c", and "d", and
> submit a form with "a" and "c" checked, then the values of $a and $c will
> be "on", and $b and $d will have no values.  It's sometimes good to use
the
> isset() function on checkbox items.  In this case, isset($a) would return
1
> and isset($b) would return 0.  Hope that helps.
>
> Jeff
>
> At 10:07 PM 3/2/2002 -0700, Ben Turner wrote:
> >Don't checkboxes, if you name them all the same name, produce a comma
> >delimited string in php of the values selected???
> >
> >such as for 15 checkboxes with numeric values would produce a string such
> >as
> >
> >,,,1314,,,18
> >
> >when the form was submited??  This is the way it was handled in ASP... is
> >there something different for PHP?
> >
> >thanks!
> >Ben
>
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] CheckBoxes....

2002-03-02 Thread GENESiS DESiGNS

Ben,

Hmm... I don't really understand you question, but when I had check boxes in a 
form, you have to name them all the same but the value all different. For 
example:






Now as far as the PHP script I think you need to use the implode(); function.


-GENESiS DESiGNS
-Sean Kennedy
-http://www.gdesigns.vcn.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] CheckBoxes....

2002-03-02 Thread Jeff Sheltren

As far as I know, you can't name different checkboxes with the same name 
(seems odd to me to do this anyway...).  When you submit a form to a php 
page, the php page will have a variable for each input item in your 
form.  So if you have checkbox items named, "a", "b", "c", and "d", and 
submit a form with "a" and "c" checked, then the values of $a and $c will 
be "on", and $b and $d will have no values.  It's sometimes good to use the 
isset() function on checkbox items.  In this case, isset($a) would return 1 
and isset($b) would return 0.  Hope that helps.

Jeff

At 10:07 PM 3/2/2002 -0700, Ben Turner wrote:
>Don't checkboxes, if you name them all the same name, produce a comma 
>delimited string in php of the values selected???
>
>such as for 15 checkboxes with numeric values would produce a string such 
>as
>
>,,,1314,,,18
>
>when the form was submited??  This is the way it was handled in ASP... is 
>there something different for PHP?
>
>thanks!
>Ben



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] checkboxes vs text filed array and hidden variables

2002-01-14 Thread Jason Wong

On Monday 14 January 2002 06:03, m. ali wrote:
> Hi
>
> my problem :
> i have to pass the price, and part number which i get from the database to
> the shopping cart so when i select some
> of the items by checking the checkboxes and submit the form i get only the
> last item in the list
>
> i use hidden variables to pass these values to shopping cart.
>
> my code look like this:
>
> echo " value=\"$product_id\">";
> echo " value=\"1\"  >";
> echo"";
> echo " name=\"part_number\"/>"; echo " value=\"$discount_price\"
> name=\"discount_price\"/>";


But what is your question? Does the above code work? If not does it give any 
error messages? Help us to help you by giving us some details :)


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

/*
The probability of someone watching you is proportional to the
stupidity of your action.
*/

-- 
PHP General 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] Checkboxes / Undefined Variables

2001-11-13 Thread Jason G.

your error reporting must be set to E_ALL.

a very simple way is:
$checkbox_3 = isset($checkbox_3);

Now, $checkbox_3 will be either TRUE or FALSE with no errors!

-Jason Garber
IonZoft.com

At 06:03 AM 11/14/2001 +, [EMAIL PROTECTED] wrote:
>In am HTML form, checkboxes NOT checked are not passed
>to the PHP script called by the form.
>
>Therefore, if $name_of_chechbox_3 is not passed but it's
>used in the PHP script, it results in "Warning:
>Undefined Variable".
>
>How can I avoid this?
>
>Thanks!
>
>A. F. Rodriguez
>([EMAIL PROTECTED])
>
>--
>PHP General 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 General 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] Checkboxes / Undefined Variables

2001-11-13 Thread Martin Towell

use : @$name_of_chechbox_3   to suppress warnings
or at the start of the file do :
if (!isset($name_of_chechbox_3))  $name_of_chechbox_3 = "";
or something similar

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 14, 2001 5:03 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Checkboxes / Undefined Variables


In am HTML form, checkboxes NOT checked are not passed 
to the PHP script called by the form.

Therefore, if $name_of_chechbox_3 is not passed but it's 
used in the PHP script, it results in "Warning: 
Undefined Variable".

How can I avoid this?

Thanks!

A. F. Rodriguez
([EMAIL PROTECTED])

-- 
PHP General 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] checkboxes

2001-10-26 Thread Jim Lucas

function jsFunc()
{
//  then check the status of the checkbox
if (checked)
{
run this
} else {
run this
}
}

onClick="jsFunc()"

Jim Lucas
- Original Message - 
From: "Johnson, Kirk" <[EMAIL PROTECTED]>
To: "PHP General (E-mail)" <[EMAIL PROTECTED]>
Sent: Friday, October 26, 2001 2:06 PM
Subject: RE: [PHP] checkboxes


> onClick
> 
> Kirk
> 
> > -Original Message-
> > From: Boaz Yahav [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, October 26, 2001 3:03 PM
> > To: PHP General (E-mail)
> > Subject: [PHP] checkboxes
> > 
> > 
> > does anyone know the HTML event that knows when a checkbox has been
> > checked and unchecked?
>  
> 
> -- 
> PHP General 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 General 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] checkboxes

2001-10-26 Thread Johnson, Kirk

onClick

Kirk

> -Original Message-
> From: Boaz Yahav [mailto:[EMAIL PROTECTED]]
> Sent: Friday, October 26, 2001 3:03 PM
> To: PHP General (E-mail)
> Subject: [PHP] checkboxes
> 
> 
> does anyone know the HTML event that knows when a checkbox has been
> checked and unchecked?
 

-- 
PHP General 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] CheckBoxes and Arrays

2001-09-11 Thread Don Read


On 12-Sep-2001 Christopher William Wesley wrote:
> On Tue, 11 Sep 2001, Ryan Stephens wrote:
> 
>> Im trying to output a list of options, each with a checkbox named "ChkBox"
> ...
> 
> Name each checkbox "ChkBox[]" ... the brackets are the key.
> 
> When the form is submitted, you'll have an array called $ChkBox that will
> contain the data only from the checked checkboxes.  You can loop over that
> array pretty simply.
> 
> for( $i = 0; $i < sizeof( $ChkBox ); $i++ ){
>   print( $ChkBox[$i] . " was checked" );
>   // Delete the row from the database, etc ...
> }
> 

$p=array();
while (list($k,$v) = each($cbk)) {
$p[]=$k;
}
$ids=implode("','", $p);
$qry="DELETE FROM foo WHERE id IN ('$ids')";
mysql_query($qry);
>

Regards,
-- 
Don Read   [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

-- 
PHP General 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] CheckBoxes and Arrays

2001-09-11 Thread Christopher William Wesley

On Tue, 11 Sep 2001, Ryan Stephens wrote:

> Im trying to output a list of options, each with a checkbox named "ChkBox"
...

Name each checkbox "ChkBox[]" ... the brackets are the key.

When the form is submitted, you'll have an array called $ChkBox that will
contain the data only from the checked checkboxes.  You can loop over that
array pretty simply.

for( $i = 0; $i < sizeof( $ChkBox ); $i++ ){
print( $ChkBox[$i] . " was checked" );
// Delete the row from the database, etc ...
}



~Chris   /"\
 \ / Pine Ribbon Campaign
Microsoft Security Specialist X  Against Outlook
The moron in Oxymoron.   / \ http://www.thebackrow.net


-- 
PHP General 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] checkboxes & sessions thanks

2001-02-20 Thread kaab kaoutar

Hi!
well I've managed to make it work by comparing the checkbbox value (on)!
Thanks anyway

_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


-- 
PHP General 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] checkboxes & sessions

2001-02-20 Thread Chris Lee

is it ok to just check the ckecboxs and hit submit? thats what most sites
do? thats real easy todo. follow up if you want some code examples.


--


Chris Lee
Mediawaveonline.com

em. [EMAIL PROTECTED]

ph. 250.377.1095
ph. 250.376.2690
fx. 250.554.1120



""kaab kaoutar"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi folks!
>
> How can i do the following using php:
> in a page i have many checkboxes that were generated dynamically,
> the user may check many of them, i want that when a checkbox is checked,
add
> it to a session variable !
> i thaught of using javascript, but i can't use session variables in
> javascript.
> Any idea please ?!
> _
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
>
> --
> PHP General 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 General 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] checkboxes and arrays

2001-02-13 Thread Christian Dechery


>$num_inputs = 5; // if you want 5 sets of checkboxes and text inputs.
>
>for ( $i = 0; $i < $num_inputs; $i++ )
> {
> echo "Cb $i name=text[$i]>\n";
> }

yeah... that can work, I think it's a little less messy than what I've 
done... I did it like this:

for each checkbox I did
echo " Cb1 ";

then I check if isset(${"asset_".$id}) in my code... it's working fine... 
but it's kinda 'dirty'... I'll try yours... thanks! :)

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General 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] checkboxes and arrays

2001-02-12 Thread Steve Werby

"Christian Dechery" <[EMAIL PROTECTED]> wrote:
> How can I associate a list of checkboxes to a list of texfields?
> but what if have:
> Cb1  Cb2 
> how would I associate each textfield to its checkbox? In the same array?
in
> a different one? How??

I would recommend generating these checkbox / text input field combos within
a loop and assign to separate arrays with the same key so you can match them
up when processing later.  Like this:

$num_inputs = 5; // if you want 5 sets of checkboxes and text inputs.

for ( $i = 0; $i < $num_inputs; $i++ )
{
echo "Cb $i \n";
}

--
Steve Werby
COO
24-7 Computer Services, LLC
Tel: 804.817.2470
http://www.247computing.com/


-- 
PHP General 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] checkboxes into MySQL

2001-01-15 Thread Kevin McCarthy

it took me a while to find this out, too.

If you have say, 5 checkboxes, name them like so:







when submitted, in the script processing the form, check the array 
$musicians[]. The checked selections will be included as elements.

So if trane and bird were checked, you will have a 2-element array in 
$musicians[].
$musicians[0] == "trane"
$musicians[1] == "bird"

HTH.

At 02:03 PM 1/15/2001 -0800, Jerry Lake wrote:
>I know this has been discussed,
>but it messing with me.
>
>in a script I'm working on
>I pull out an array of checkboxes
>from a database,
>
>how do I store what people select
>back to the DB
>
>all I end up with is the last selection
>of the array.
>
>Jerry Lake
>
>-Original Message-
>From: jeremy brand [mailto:[EMAIL PROTECTED]]
>Sent: Monday, January 15, 2001 1:57 PM
>To: WreckRman2
>Cc: 'Php-General@Lists. Php. Net'
>Subject: Re: [PHP] Array...
>
>
>for ($i=100; $i>0; $i++)
>   print "\n";
>
>But, I presume you would rather do this:
>for ($i=100; $i>0; $i++)
>   print "\n";
>
>because I can't imagine why you would want to escape double quotes in
>HTML.
>
>Jeremy
>
>Jeremy Brand :: Sr. Software Engineer :: 408-245-9058 :: [EMAIL PROTECTED]
>http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html for more
>Get your own Free, Private email at http://www.smackdown.com/
>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>""   -- Quoted from Yahoo! homepage, http://www.yahoo.com
>
>On Mon, 15 Jan 2001, WreckRman2 wrote:
>
> > Date: Mon, 15 Jan 2001 16:48:21 -0500
> > From: WreckRman2 <[EMAIL PROTECTED]>
> > To: "'Php-General@Lists. Php. Net'" <[EMAIL PROTECTED]>
> > Subject: [PHP] Array...
> >
> >
> > How can I do an array like below 100-1?
> >
> > 
> > 
> > 
> > 
> >
> > to
> >
> > 
> > 
> > 
> >
> >   WreckRman2
> >   Combat Flight Center
> >   http://www.combatfs.com
> >
> > --
> > PHP General 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 General 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 General 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]

Kevin McCarthy  Body & Soul
http://www.bodynsoul.com


-- 
PHP General 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] checkboxes into MySQL(trying again)

2001-01-15 Thread jeremy brand

Hi Jerry,

Feel free (as in GPL) to use my libHtmlForm functions.  This should
solve your problem.

http://www.nirvani.net/software/libHtmlForm/

See: html_input_checkbox() specifically.

Jeremy

Jeremy Brand :: Sr. Software Engineer :: 408-245-9058 :: [EMAIL PROTECTED]
http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html for more 
Get your own Free, Private email at http://www.smackdown.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   ""   -- Quoted from Yahoo! homepage, http://www.yahoo.com

On Mon, 15 Jan 2001, Jerry Lake wrote:

> Date: Mon, 15 Jan 2001 14:11:18 -0800
> From: Jerry Lake <[EMAIL PROTECTED]>
> To: "'Php-General@Lists. Php. Net'" <[EMAIL PROTECTED]>
> Subject: [PHP] checkboxes into MySQL(trying again)
> 
> sorry about that,
> I forgot to erase the old post
> info
> 
> here is a chunk of the code I am using
> 
> //inclusion of pizza toppings from DB
> $query = ("SELECT * FROM toppings");
> $result2 = mysql_db_query($DBName, $query) or
> die("Error in MySQL query");
> 
> echo "";
> echo "";
> 
> $colors = array( '#e4e4e4', '#ff' );
>  
> $i = 0;
> 
> while($myrow =  mysql_fetch_array($result2)) {
>   $counter++;
>   if ($counter > "4") {
>  $counter = "1";
>   echo "";
>   }
> $name = $myrow["name"];
> $personal_cost = $myrow["personal_cost"];
> $small_cost = $myrow["small_cost"];
> $medium_cost = $myrow["medium_cost"];
> $large_cost = $myrow["large_cost"];
> $category = $myrow["category"];
> 
> 
> 
> echo "\r\n";
> echo "".$name."";
> echo "\r\n";
> }
> if ($counter < 3) {
> while ($counter < 3) {
>   echo " ";
>   $counter++;
> }
> }
> echo "";
> 
> echo "";
> // memory flush
> mysql_free_result($result2);
> //end topping section
> 
> 
> Jerry Lake- [EMAIL PROTECTED]
> Web Designer
> Europa Communications - http://www.europa.com
> Pacifier Online   - http://www.pacifier.com
> 
> 
> 
> -- 
> PHP General 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 General 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] checkboxes into MySQL

2001-01-15 Thread jeremy brand

What I see is that the below is not an array of checkboxes (that would
be , not ).   ... are
part of a 

But, to make a checkbox be checked, you simply do this:


Jeremy

Jeremy Brand :: Sr. Software Engineer :: 408-245-9058 :: [EMAIL PROTECTED]
http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html for more 
Get your own Free, Private email at http://www.smackdown.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   ""   -- Quoted from Yahoo! homepage, http://www.yahoo.com

On Mon, 15 Jan 2001, Jerry Lake wrote:

> Date: Mon, 15 Jan 2001 14:03:00 -0800
> From: Jerry Lake <[EMAIL PROTECTED]>
> To: "'Php-General@Lists. Php. Net'" <[EMAIL PROTECTED]>
> Subject: [PHP] checkboxes into MySQL
> 
> I know this has been discussed,
> but it messing with me.
> 
> in a script I'm working on
> I pull out an array of checkboxes
> from a database,
> 
> how do I store what people select
> back to the DB
> 
> all I end up with is the last selection
> of the array.
> 
> Jerry Lake 
> 
> -Original Message-
> From: jeremy brand [mailto:[EMAIL PROTECTED]]
> Sent: Monday, January 15, 2001 1:57 PM
> To: WreckRman2
> Cc: 'Php-General@Lists. Php. Net'
> Subject: Re: [PHP] Array...
> 
> 
> for ($i=100; $i>0; $i++)
>   print "\n";
> 
> But, I presume you would rather do this:
> for ($i=100; $i>0; $i++)
>   print "\n";
> 
> because I can't imagine why you would want to escape double quotes in
> HTML.
> 
> Jeremy
> 
> Jeremy Brand :: Sr. Software Engineer :: 408-245-9058 :: [EMAIL PROTECTED]
> http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html for more 
> Get your own Free, Private email at http://www.smackdown.com/
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>""   -- Quoted from Yahoo! homepage, http://www.yahoo.com
> 
> On Mon, 15 Jan 2001, WreckRman2 wrote:
> 
> > Date: Mon, 15 Jan 2001 16:48:21 -0500
> > From: WreckRman2 <[EMAIL PROTECTED]>
> > To: "'Php-General@Lists. Php. Net'" <[EMAIL PROTECTED]>
> > Subject: [PHP] Array...
> > 
> > 
> > How can I do an array like below 100-1?
> > 
> > 
> > 
> > 
> > 
> > 
> > to
> > 
> > 
> > 
> > 
> > 
> > WreckRman2
> > Combat Flight Center
> > http://www.combatfs.com
> > 
> > -- 
> > PHP General 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 General 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 General 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 General 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]