You are here: Re: Replacing $_POST array contents - is it allowed? « All PHP « IT news, forums, messages
Re: Replacing $_POST array contents - is it allowed?

Posted by Tyrone Slothrop on 10/12/05 05:43

On Wed, 12 Oct 2005 02:46:54 +0200, "A" <a@a.a> wrote:

>I need to modify $_POST array to have default values if some variable is not
>present or empty i.e.:
>
>if (!isset($_POST['foo']))
> {
> $_POST['foo'] = 'my default';
> }
>
>the code above works, but I'm wondering - is this "legal" to do like this.
>considering $_POST is superglobal it should be OK, but considering it is
>reserved array it may not be ok... any oppinions?
>
>I could rewrite this into something that would fill variables with the
>$_POST contents but why not doing it directly on $_POST if it is allowed...
>it is simpler to handle.

I have been doing this for years. Have not been busted by the PHP
police yet. ;-) All you are doing is assigning a new value to the
element of an array.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация