You are here: Re: Code for searching a mysql database on multiple terms inputed from an html form « All PHP « IT news, forums, messages
Re: Code for searching a mysql database on multiple terms inputed from an html form

Posted by Fred on 09/28/80 11:57

On Tue, 05 Sep 2006 03:04:48 -0400, Koncept wrote...
>
>In article <1157211267.359847.323430@p79g2000cwp.googlegroups.com>,
>kenoli <kenoli@igc.org> wrote:
>
>> I'm quite impressed and learned a bunch of things from this including
>> some things about html I didn't know.
>
>:)
>
>>
>> I want to make sure I undeerstand something I didn't know before:
>>
>> In the tags where you include something like: name = "proc[firstname]"
>>
>>
>> I presume that what is going on here is that an array called "proc[]"
>> is being created as an element in the global $_POST variable which
>> contains the content of the input fileds associated with their name
>> attributes as keys. For each input, a new array elemtn with key is
>> concatenated to the proc[] array. Do I understand this correctly?
>>
>> If so, this is quite elegant.
>
>You got it.
>
>> Is there some specific reason you did it this way. I could imagine
>> keying the switch statement to a text key assigned by each name
>> attribute, as well.
>
>It's tidier to build containers for related data. If I had an array set
>containing customer details such as name, email, etc etc, I could
>simply session that one post variable (since it is an array). Another
>little cheat I sometimes use is casting the array to an object so that
>I can avoid typing so many quotes and brackets:
>
><?php
>$a["name"] = "joe";
>$a["age"] = "55"];
>...
>$a = (object) $a;
>echo "The person named ",$a->name, " is ",$a->age," years old.";
>?>
>
>* Yes... I am lazy enough that saving two keystrokes matters ;)
>



Never tried using objects before with PHP. Thanks for the tip, I prefer saving
keystrokes when I can too. :-)

--
Help a community by participating in ours!
NewsGuy.Com - http://newsguy.com/charity.asp





>> I hadn't been aware of how many tags can be associated with html form
>> elements. Many of those included here are obviously not utilized in
>> the included php script, but I can see how they could be used. Is
>> there some reason you included them?
>
>My editor is snippet based and automatically creates some predefined
>attributes such as ID with certain tags. Since I often use javascript
>and CSS to help with the look/feel/function of pages, ID attributes
>have become something of a necessity over time since they can uniquely
>single out nodes.
>
>> What is your reason for including the CDATA striing in the style
>> section. I know generally what this does but wonder about its
>> application here. Is it just to create bulletproof code or is there a
>> specific function? I presume any interpreter that cares about it will
>> read through the comment tags.
>
>More recent XHTML standards process code between script tags as PCDATA
>( parsed character data ) - which is then evaluated by validators.
>Since this is not valid XHTML markup, you would have an invalid page.
>Using CDATA sections ( character data ), the markup contained in these
>regions is ignored and guarentees that the page is processed properly
>by browsers which cannot properly support the XHTML DTD.
>
>>
>> Any reason for using if indif format instead of {} in the if statement
>> aside from personal style? Ditto for "foreach."
>
>Just a style I use depending on what I am doing. Nothing more than
>personal preference.
>

 

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

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