[PHP] Code help on a multi select list

2004-10-29 Thread Stuart Felenstein
I want to do a server side trap if a user selects more
from a mult select list then allowed.  Just unsure and
didn't find any examples.  Seems people rely more on
javascript these days.  

So here is how I grab the array:

if ( is_array( $_REQUEST['LurkerIndustry'] ) ) {
$_SESSION['l_industry'] = array_unique(
array_merge( $_SESSION['l_industry'],
 $_REQUEST['LurkerIndustry'] )
);
}

here is my somewhat hazy notion: 

if 
( is_array( $_REQUEST['LurkerIndustry'] ) ) {
$_SESSION['l_industry'] = array_unique(
if $l_industry  5 
   ( Here I'm guess I need to redirect back to page   
 with and error message)

else
array_merge( $_SESSION['l_industry'],
 $_REQUEST['LurkerIndustry'] )
);
}

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



RE: [PHP] Code help on a multi select list

2004-10-29 Thread Jay Blanchard
[snip]
I want to do a server side trap  Seems people rely more on
javascript these days.  
[/snip]

There is a reason for that. It is in the first chapter of the popular
book 
Server Side is From Mars,
Client Side is From Venus.

Make no mistake, people often confuse the two. You, being the smart
programmer that you are, know that PHP is a server-side language and
JavaScript (often known as ECMAScript 290) is a client-side language.
You must be in touch with both sides to become an effective programmer
in today's world.

Other languages are also mentioned.

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



RE: [PHP] Code help on a multi select list

2004-10-29 Thread Reinhart Viane
I would choose javascript to to check this

-Original Message-
From: Stuart Felenstein [mailto:[EMAIL PROTECTED] 
Sent: vrijdag 29 oktober 2004 15:13
To: [EMAIL PROTECTED]
Subject: [PHP] Code help on a multi select list


I want to do a server side trap if a user selects more
from a mult select list then allowed.  Just unsure and
didn't find any examples.  Seems people rely more on
javascript these days.  

So here is how I grab the array:

if ( is_array( $_REQUEST['LurkerIndustry'] ) ) { $_SESSION['l_industry']
= array_unique( array_merge( $_SESSION['l_industry'],
$_REQUEST['LurkerIndustry'] ) ); }

here is my somewhat hazy notion: 

if 
( is_array( $_REQUEST['LurkerIndustry'] ) ) { $_SESSION['l_industry'] =
array_unique( if $l_industry  5 
   ( Here I'm guess I need to redirect back to page   
 with and error message)

else
array_merge( $_SESSION['l_industry'],  $_REQUEST['LurkerIndustry'] ) );
}

-- 
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] Code help on a multi select list

2004-10-29 Thread Stuart Felenstein
--- Reinhart Viane [EMAIL PROTECTED] wrote:

 I would choose javascript to to check this
 

This response I don't understand.   There are 50
options and the intent is to allow 3 of those 50. 
Then some genius comes along and turns off
javascripting and chooses all 50.  I KNOW it will
happen.  I wouldn't even dare to dream that it may
not.  

Stuart

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



RE: [PHP] Code help on a multi select list

2004-10-29 Thread Reinhart Viane

It is not my intention to start a discussion on this, however, some
things, as you surely know, are better handled with javascript. If you
turn it the way you say now, I can follow your idea and thus you are
correct. It has te be very closed it seems.

Will look into it :)

-Original Message-
From: Stuart Felenstein [mailto:[EMAIL PROTECTED] 
Sent: vrijdag 29 oktober 2004 15:29
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP] Code help on a multi select list


--- Reinhart Viane [EMAIL PROTECTED] wrote:

 I would choose javascript to to check this
 

This response I don't understand.   There are 50
options and the intent is to allow 3 of those 50. 
Then some genius comes along and turns off
javascripting and chooses all 50.  I KNOW it will
happen.  I wouldn't even dare to dream that it may
not.  

Stuart

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



Re: [PHP] Code help on a multi select list

2004-10-29 Thread Ben Ramsey
Stuart Felenstein wrote:
I would choose javascript to to check this
This response I don't understand.   There are 50
options and the intent is to allow 3 of those 50. 
Then some genius comes along and turns off
javascripting and chooses all 50.  I KNOW it will
happen.  I wouldn't even dare to dream that it may
not.  

Stuart
Precisely... you can't rely on the the client to do your checking. You 
need to check from the server side to make sure no one's going to spoof 
your code. With that in mind, you mind want to implement both 
client-side and server-side checking. That way, it gives your legitimate 
users a more user-friendly approach, while still ensuring from the 
server-side that no one's going to spoof your form.

--
Regards,
Ben Ramsey
http://benramsey.com
---
Atlanta PHP - http://www.atlphp.org/
The Southeast's premier PHP community.
---
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Code help on a multi select list

2004-10-29 Thread Jay Blanchard
[snip]
--- Reinhart Viane [EMAIL PROTECTED] wrote:

 I would choose javascript to to check this
 

This response I don't understand.   [/snip]

What is not to understand here...you are the one who said, I want to do
a server side trap. JavaScript would be the only way to do that. I
agree with Ben who said to do both.

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



Re: [PHP] Code help on a multi select list

2004-10-29 Thread Ben Ramsey
Jay Blanchard wrote:
[snip]
I would choose javascript to to check this
This response I don't understand.   [/snip]
What is not to understand here...you are the one who said, I want to do
a server side trap. JavaScript would be the only way to do that. I
agree with Ben who said to do both.
I don't understand this response. ;-)
How is Javascript the /only way/ to do a /server-side/ trap? Javascript 
is for the client side (unless you're coding in ASP and choose to use 
JScript instead of VBScript).

--
Regards,
Ben Ramsey
http://benramsey.com
---
Atlanta PHP - http://www.atlphp.org/
The Southeast's premier PHP community.
---
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Code help on a multi select list

2004-10-29 Thread Stuart Felenstein

--- Jay Blanchard
[EMAIL PROTECTED] wrote:

 What is not to understand here...you are the one who
 said, I want to do
 a server side trap. JavaScript would be the only
 way to do that. 

Sorry, I used the wrong terminology.  I think my
statement was interpreted as using javascript at the
server level.

Stuart

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



Re: [PHP] Code help on a multi select list

2004-10-29 Thread Greg Donald
On Fri, 29 Oct 2004 09:36:07 -0400, Ben Ramsey [EMAIL PROTECTED] wrote:
 Precisely... you can't rely on the the client to do your checking. You
 need to check from the server side to make sure no one's going to spoof
 your code. With that in mind, you mind want to implement both
 client-side and server-side checking. That way, it gives your legitimate
 users a more user-friendly approach, while still ensuring from the
 server-side that no one's going to spoof your form.

I agree.  No sense in blasting a bad form post off to the server if
you can preempt it with javascript.  Put the load on the client when
possible I say.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



RE: [PHP] Code help on a multi select list

2004-10-29 Thread Graham Cossey
[snip]
 What is not to understand here...you are the one who said, I want to do
 a server side trap. JavaScript would be the only way to do that.
[snip]

Jay, you may want to re-read what you typed as JavaScript, to the best of my
knowledge, is actually client side...

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



RE: [PHP] Code help on a multi select list

2004-10-29 Thread Jay Blanchard
[snip]

-Original Message-
From: Ben Ramsey [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 29, 2004 8:55 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Code help on a multi select list


Jay Blanchard wrote:
 [snip]
I would choose javascript to to check this
 
 This response I don't understand.   [/snip]
 
 What is not to understand here...you are the one who said, I want to
do
 a server side trap. JavaScript would be the only way to do that. I
 agree with Ben who said to do both.

I don't understand this response. ;-)

How is Javascript the /only way/ to do a /server-side/ trap? Javascript 
is for the client side (unless you're coding in ASP and choose to use 
JScript instead of VBScript).
[/snip]

I don't understand this response. ;-)

The OP said JavaScript, so I couched it in those terms.

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



RE: [PHP] Code help on a multi select list

2004-10-29 Thread Jay Blanchard
[snip]
[snip]
 What is not to understand here...you are the one who said, I want to
do
 a server side trap. JavaScript would be the only way to do that.
[snip]

Jay, you may want to re-read what you typed as JavaScript, to the best
of my
knowledge, is actually client side...
[/snip]

I was just testing ya'lland somebody caught it! And I am still
asleep.

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



Re: [PHP] Code help on a multi select list

2004-10-29 Thread John Nichel
Graham Cossey wrote:
[snip]
What is not to understand here...you are the one who said, I want to do
a server side trap. JavaScript would be the only way to do that.
[snip]
Jay, you may want to re-read what you typed as JavaScript, to the best of my
knowledge, is actually client side...
It's Friday, and Jay probably needs coffee. ;)
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Code help on a multi select list

2004-10-29 Thread John Nichel
Jay Blanchard wrote:
snip
I don't understand this response. ;-)
The OP said JavaScript, so I couched it in those terms.
How do you respond to that response when the previous responder 
responded? :)

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Code help on a multi select list

2004-10-29 Thread Jay Blanchard
[snip]
It's Friday, and Jay probably needs coffee. ;)
[/snip]

Make mine Communicty New Orleans Blend w/Chicory pleaseintravenously
please...

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



Re: [PHP] Code help on a multi select list

2004-10-29 Thread Greg Donald
On Fri, 29 Oct 2004 10:15:57 -0500, Jay Blanchard
[EMAIL PROTECTED] wrote:
 Make mine Communicty New Orleans Blend w/Chicory pleaseintravenously
 please...

Bah..  Mountain Dew and a couple of Sudafed is where it's at.  :)


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] Code help on a multi select list

2004-10-29 Thread John Nichel
Greg Donald wrote:
On Fri, 29 Oct 2004 10:15:57 -0500, Jay Blanchard
[EMAIL PROTECTED] wrote:
Make mine Communicty New Orleans Blend w/Chicory pleaseintravenously
please...

Bah..  Mountain Dew and a couple of Sudafed is where it's at.  :)
The blood running thru my veins is about 85% Mt. Dew, but being from New 
Orleans, I understand that Community New Orleans Blend will slap you 
around a little bit after waking you up. ;)

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Code help on a multi select list

2004-10-29 Thread Stuart Felenstein

--- Greg Donald [EMAIL PROTECTED] wrote:

 Bah..  Mountain Dew and a couple of Sudafed is where
 it's at.  :)
 
 
That just doesn't sound right.

Stuart

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