Re: making checkbox's and radio buttons sticky

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Support wrote:
ok....I got it!!

not wanting to go down the path of the darkside...I inserted the
superglobals..

if (isset($_POST['gmev']) && in_array('September 9th', $_POST['gmev']))

so did I get it right?

there are many roads to Rome. using isset() and in_array() is a
very good start indeed! (you'd be surprised at how many people don't check
vars at all) you might consider either casting $_POST['gmev']
as an array at some stage:

$myArr = (array)$_POST['gmev']

or also using is_array() to check that $_POST['gmev'] is actually an array.

another technique sometimes used is to suppress the error in cases when
you need speed AND you know the error is of no consequence:

if (@in_array('September 9th', @$_POST['gmev'])) {
	// bla
}

notice 2 @ signs. the first suppresses the warning about possible in correct
2nd param to in_array() the second will suppress the notice if $_POST['gmev']
is not set.

be very wary of the @ sign - don't use it lightly, most always using isset()
in combination with a is_*() function is much much better (and more correct.

also check out the ctype functions:
http://php.net/ctype



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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux