Re: [PHP] parsing select multiple="multiple"

2013-02-19 Thread John Taylor-Johnston


tamouse mailing lists wrote:

>I hate arrays. :D

Here's a small snippet showing how it works, I hope:

foreach ($DPRpriority as $item => $value) {
   echo " ".$item.": ".$value['name']." selected:
".$value['selected']." \n";
}

Question 1: when did we have to add [] to a  name to turn it into 
an array?




According to phpinfo() it still comes out as 
$_POST['DPRlocationdetails'] without [].


Are the [] necessary?
--
Question 2:
I was looking at some code in the Manual, where someone used isset and 
is_array.


How necessary is if(isset($_POST['DPRlocationdetails']))

and then to use: if(is_array($_POST['DPRlocationdetails']))

That seems like over kill?
--
Question 3:

My code works, perfectly. In this case, I decided to attack some 
check-boxes first. The resulting function will work for multiple> too..


Does anyone see me doing something wrong in my code below?

My questions are:

Is this the only way to pass "Unknown", "Family Home" or "Apartment" 
into the function?


Is this correct?

 if ($_POST['DPRlocationdetails'] == "Unknown")

Somebody once told me I had to do it this way?

 if ("Unknown" == $_POST['DPRlocationdetails'])

John

snip---

type="submit">
filter_value($_POST['DPRlocationdetails'],"Unknown"); ?>> Unknown
> 
Family Home
> Apartment







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



Re: [PHP] parsing select multiple="multiple"

2013-02-19 Thread Jim Giner

On 2/19/2013 2:02 PM, John Taylor-Johnston wrote:


tamouse mailing lists wrote:

>I hate arrays. :D

Here's a small snippet showing how it works, I hope:

foreach ($DPRpriority as $item => $value) {
   echo " ".$item.": ".$value['name']." selected:
".$value['selected']." \n";
}


Question 1: when did we have to add [] to a  name to turn it into
an array?



According to phpinfo() it still comes out as
$_POST['DPRlocationdetails'] without [].

Are the [] necessary?
--
Question 2:
I was looking at some code in the Manual, where someone used isset and
is_array.

How necessary is if(isset($_POST['DPRlocationdetails']))

and then to use: if(is_array($_POST['DPRlocationdetails']))

That seems like over kill?
--
Question 3:

My code works, perfectly. In this case, I decided to attack some
check-boxes first. The resulting function will work for  too..

Does anyone see me doing something wrong in my code below?

My questions are:

Is this the only way to pass "Unknown", "Family Home" or "Apartment"
into the function?

Is this correct?

 if ($_POST['DPRlocationdetails'] == "Unknown")

Somebody once told me I had to do it this way?

 if ("Unknown" == $_POST['DPRlocationdetails'])

John

snip---


> Unknown
>
Family Home
> Apartment





The [] are necessary if there are going to be multiple occurrences of an 
input with the same name, hence the [] to allow your php script to 
extract all of the occurrences.


Using isset and is_array comes in handy to help you handle the incoming 
var properly.  If it IS set, you then have to check if there is only one 
value (hence a string) or if there are multiple values (an array).


#3 - no idea what you are asking.   

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



[PHP] Re: [PHP-DEV] PHP 5.3.22RC1 and 5.4.12RC1 Released for Testing!

2013-02-19 Thread Jan Ehrhardt
Johannes Schlüter in php.internals (Thu, 31 Jan 2013 16:00:17 +0100):
>If no critical issues is found in this RC, the final version will be
>released in two weeks.

Just curious: what is keeping 5.3.22 and 5.4.12 from being released?
Are there any issues?

Jan

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



[PHP] Re: [PHP-DEV] PHP 5.3.22RC1 and 5.4.12RC1 Released for Testing!

2013-02-19 Thread Johannes Schlüter
On Wed, 2013-02-20 at 00:13 +0100, Jan Ehrhardt wrote:
> Johannes Schlüter in php.internals (Thu, 31 Jan 2013 16:00:17 +0100):
> >If no critical issues is found in this RC, the final version will be
> >released in two weeks.
> 
> Just curious: what is keeping 5.3.22 and 5.4.12 from being released?
> Are there any issues?

As a look on qa.php.net or the box on the top right of php.net tells we
have RC2 for both out, you can also see in the repo that the release is
being prepared:

http://git.php.net/?p=php-src.git;a=blobdiff;f=NEWS;h=d3a3e9fa0f344d9b736ea17ce408df6b02e8b561;hp=c4262020de69b7a93b8fcf4923e85194756435a7;hb=0183c29cb3921926855ed6f5e7cea7851fb8a5a1;hpb=904d2202eaecb7c300c36f37ebc5503513220c09

Please test the RCs and provide test feedback. Thanks.

johannes



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



[PHP] Re: [PHP-DEV] PHP 5.3.22RC1 and 5.4.12RC1 Released for Testing!

2013-02-19 Thread Stas Malyshev
Hi!

> Johannes Schlüter in php.internals (Thu, 31 Jan 2013 16:00:17 +0100):
>> If no critical issues is found in this RC, the final version will be
>> released in two weeks.
> 
> Just curious: what is keeping 5.3.22 and 5.4.12 from being released?
> Are there any issues?

We had 5.4.12 RC2 last week, due to recent SOAP fixes we had to pull in,
and will have 5.4.12 GA this week.


-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

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



[PHP] Re: [PHP-DEV] PHP 5.3.22RC1 and 5.4.12RC1 Released for Testing!

2013-02-19 Thread Jan Ehrhardt
Stas Malyshev in php.internals (Tue, 19 Feb 2013 15:35:54 -0800):
>> Johannes Schlüter in php.internals (Thu, 31 Jan 2013 16:00:17 +0100):
>>> If no critical issues is found in this RC, the final version will be
>>> released in two weeks.
>> 
>> Just curious: what is keeping 5.3.22 and 5.4.12 from being released?
>> Are there any issues?
>
>We had 5.4.12 RC2 last week, due to recent SOAP fixes we had to pull in,
>and will have 5.4.12 GA this week.

OK. Johannes' reply made me think I mistook the final RC for the
release, but you seem to indicate there was indeed a little delay.

For Johannes: building 5.3.22 and 5.4.12 (both NTS, Windows) right now.
I will report back if I run into something.

Jan

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



[PHP] phpinfo()

2013-02-19 Thread John Taylor-Johnston
I cannot find button2 in phpinfo() when I click it. I was hoping to find 
a $_POST["button2"] value.

What am I doing wrong?

onclick="formSubmit()">


I really wanted to use a button to pass a different condition than a 



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



[PHP] if (empty versus if (isset

2013-02-19 Thread John Taylor-Johnston

What is the difference between?

if (empty... http://www.php.net/manual/en/function.empty.php "Determine 
whether a variable is empty"

and
if (isset... http://php.net/manual/en/function.isset.php "Determine if a 
variable is set and is not *|NULL|*"


I have an .

If it is not checked, it is NOT empty, because it has a value, right?
But it is NOT set, right?

Is this empty, because it's value is ""?



Just trying to understand ... :)


Re: [PHP] if (empty versus if (isset

2013-02-19 Thread Adam Richardson
On Tue, Feb 19, 2013 at 9:29 PM, John Taylor-Johnston
 wrote:
>
> What is the difference between?
>
> if (empty... http://www.php.net/manual/en/function.empty.php "Determine 
> whether a variable is empty"
> and
> if (isset... http://php.net/manual/en/function.isset.php "Determine if a 
> variable is set and is not *|NULL|*"


I like the explanation on the empty page:

"No warning is generated if the variable does not exist. That means
empty() is essentially the concise equivalent to !isset($var) || $var
== false."


> I have an .
>
> If it is not checked, it is NOT empty, because it has a value, right?
> But it is NOT set, right?

Some of the form elements (e.g., checkboxes, radio's) are a little tricky:
http://stackoverflow.com/questions/476426/submit-an-html-form-with-empty-checkboxes

When unchecked, no GET or POST variable is present to represent their value.

> Is this empty, because it's value is ""?
>
> 
>
> Just trying to understand ... :)

A text field would be present in the GET or POST super globals, and if
empty (the user did not add input), the empty function would return
true because an empty string is one of the values that evaluates to
false:
- "" (an empty string)
- 0 (0 as an integer)
- 0.0 (0 as a float)
- "0" (0 as a string)
- NULL
- FALSE
- array() (an empty array)
- $var; (a variable declared, but without a value)

Adam

--
Nephtali:  A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com

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



Re: [PHP] phpinfo()

2013-02-19 Thread Ashley Sheridan


John Taylor-Johnston  wrote:

>I cannot find button2 in phpinfo() when I click it. I was hoping to
>find 
>a $_POST["button2"] value.
>What am I doing wrong?
>
>onclick="formSubmit()">
>
>I really wanted to use a button to pass a different condition than a 
>

Use a different value or name on the  button. Don't use 
JavaScript to trigger the form like that. Its not necessary and will bite you 
in the ass if ypu get a visitor who browses without JavaScript, which can 
include security aware users, blind users, etc
Thanks,
Ash
http://www.ashleysheridan.co.uk

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