[PHP] HTML id attribute and arrays
Hi, PHP converts x[a]=b parameter of the HTTP request as an array named x with its item named a set to value b. So, it seems possible to have the following (X)HTML code: Unfortunatelly, HTML specification does not allow neither "[" nor "]" inside the id attribute. Specifically: * Must begin with a letter A-Z or a-z * Can be followed by: letters (A-Za-z), digits (0-9), hyphens ("-"), underscores ("_"), colons (":"), and periods (".") * Values are case-sensitive How should I follow the HTML specification while having the passed parameters automatically converted to arrays in PHP? Thank you for any tips, Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML id attribute and arrays
How should I follow the HTML specification while having the passed parameters automatically converted to arrays in PHP? The "name" attribute, not the "id" attribute, is used as the key when submitting form values. The "name" and "id" attributes do not have to be the same. Thank you, I thought it should be the same (for same reason, maybe compatibility between XHTML and HTML). But could not find anything on the net which states this. So my memories might be corrupted :) Based on first tests, it works (but have not checked the W3C validator yet). Thanks, Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML id attribute and arrays
How should I follow the HTML specification while having the passed parameters automatically converted to arrays in PHP? The "name" attribute, not the "id" attribute, is used as the key when submitting form values. The "name" and "id" attributes do not have to be the same. Thank you, I thought it should be the same (for same reason, maybe compatibility between XHTML and HTML). But could not find anything on the net which states this. So my memories might be corrupted :) Based on first tests, it works (but have not checked the W3C validator yet). Thanks, Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML id attribute and arrays
The "name" and "id" attributes do not have to be the same. Thank you, I thought it should be the same You're probably thinking of: http://www.w3.org/TR/html401/struct/links.html#h-12.2.3 "The id and name attributes share the same name space. This means that they cannot both define an anchor with the same name in the same document. It is permissible to use both attributes to specify an element's unique identifier for the following elements: A, APPLET, FORM, FRAME, IFRAME, IMG, and MAP. When both attributes are used on a single element, their values must be identical." Confusing, the "name" attribute on a form field ("input", "textarea", "select", etc) is different to the "name" attribute on a "a" or "form" element, so this rule does not apply to it. Thank you, Benjamin, for clarification. This sounds like the source of my (bogus) feeling. Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mail() - 7bit headers
How do i encode 8 bit text to 7 bit in php so that the mail server (courier) won't complain about 8 bit content in the header (From:) while still enabling mailreaders to decode it? Regards Martin Petersen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Mail stopped working - Somewhat Urgent
Bryan Gintz wrote: > All of a sudden Mail through PHP just stopped working, we can do it > through the command line, but refuses to work in PHP. > Any ideas? Does the maillog mention any errors? How about the webserver log? Best regards Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Table exists?
Nick Wilson wrote: > What would be the easiest way to see if a MySQL table exists with PHP? > I can do it by checking against mysql_list_tables() but that seems a > little clumsy. Is there a better way? Do a select on the table - if the query returns true the table exists otherwise the test is inconclusive.. Best regards Martin Petersen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] NetFlix Drag and Drop Row Ordering
I don't see anything special about my Netflix queue. Am I missing something there? And I have no idea what "Flex" is referring to, so I'll check that out if anyone lets me know where. :o) Martin Austin Burhan Khalid <[EMAIL PROTECTED]> 03/24/2005 12:27 AM To: Graham Anderson <[EMAIL PROTECTED]> cc: php-general@lists.php.net Subject:Re: [PHP] NetFlix Drag and Drop Row Ordering Graham Anderson wrote: > For those who have netflix, does anyone know how you would recreate > their 'drag and drop' queue widget? > basically, you can drag and drop movies in the order you choose > > is this a combination of javascript and php ? > how would you go about creating something like this to order rows in > your own CMS ? I don't have an account with Netflix, but Flex has a great drag and drop widget. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing... the hell of PHP
$url = ".HtmlEntities($url)."\">"."; It appears the parse error is at the end of your opening link tag, so PHP doesn't know what >.HtmlEntities($url) means. I'm at work so I can't test it, but that appears the culprit to me. $url = "" . HtmlEntities($url) . ""; should suffice. Martin Austin Mário Gamito <[EMAIL PROTECTED]> 03/30/2005 07:51 AM To: php-general@lists.php.net cc: Subject:[PHP] Parsing... the hell of PHP Hi, I'm trying to transform a url taken from the DB from "plain text", to the same, but linkable url. All i get is parse errors and alike. Here is my last (of many) attempt: $url = ".HtmlEntities($url)."\">"."; A warning and a parse error is what i get. Can't get there :( Any help would be apreciated. Warm regards, Mário Gamito -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing... the hell of PHP
Glad to have helped (though someone else beat me to the punch with the right answer!) You'll get the hang of it -- the way I learned is to write out your tag that you'd like to use like this: "text here" Then go through and escape the characters that need it: "text here" You can place variables into a string, but if you are using a function to work on that variable, you must concatenate it. "" . htmlentities($url) . ""; (needs concatenation) "$url"; (no function used, no concatenation necessary) Good luck! Martin Austin Shared Services A/R Ph 952.906.6653 Fax 952.906.6500 SUPERVALU Tradition .:. Excellence .:. Future Promise 135 Years of Fresh Thinking ... Mário Gamito <[EMAIL PROTECTED]> 03/30/2005 10:15 AM To: php-general@lists.php.net cc: Subject:Re: [PHP] Parsing... the hell of PHP Hi, Thank you all that answered my question. It worked. I think i'll never get used to this parsing PHP stuff :( Warm Regards, Mário Gamito [EMAIL PROTECTED] wrote: > $url = ".HtmlEntities($url)."\">"."; > > It appears the parse error is at the end of your opening link tag, so PHP doesn't know what >.HtmlEntities($url) means. I'm at work so I can't test it, but that appears the culprit to me. > > $url = "" . HtmlEntities($url) . ""; should suffice. > > Martin Austin > > > > > > Mário Gamito <[EMAIL PROTECTED]> > 03/30/2005 07:51 AM > > To: php-general@lists.php.net > cc: Subject:[PHP] Parsing... the hell of PHP > > > Hi, > > I'm trying to transform a url taken from the DB from "plain text", to the same, but linkable url. > > All i get is parse errors and alike. > > Here is my last (of many) attempt: > > $url = ".HtmlEntities($url)."\">"."; > > A warning and a parse error is what i get. > Can't get there :( > > Any help would be apreciated. > > Warm regards, > Mário Gamito > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to format every secound row in a database result
Or you could simply test the $color variable to see its contents, and change it if it's what you expected: $color = "#FF"; if($color = "#FF") { $color = "#00"; //output } else { $color = "#FF"; } There may be something inherently wrong in this approach, but it has always worked for me. :o) Martin Austin Miles Thompson <[EMAIL PROTECTED]> 03/30/2005 10:18 AM To: php-general@lists.php.net cc: Subject:Re: [PHP] How to format every secound row in a database result Maintain a counter as you display the returned results. Mod the counter by 2 (rowcounter % 2), set colour according to presence / absence of a remainder. Miles At 11:05 AM 3/30/2005, Georg wrote: >Hi! > >I wish to format the output of a database select. >The result is presented in a table, in which i'd like to present everey >secound row with a different background color. >My idea was to test if the remaining number of rows where a prime number or >not, and by that determent if the background color should be white or som >ivory-like color to improve the readability in the result table... > >Hope to hear from anyone with experience in similar matters... > >TIA! Georg Herland, Norway > >-- >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: Re[6]: [PHP] asking comment
I agree with this solution, though it only effects the OP if he is using a login system of sorts. Martin Austin "Mikey" <[EMAIL PROTECTED]> 03/30/2005 12:39 PM Please respond to frak To: cc: Subject:RE: Re[6]: [PHP] asking comment How about a filename based upon a user id and the time the file was uploaded. Unless you have multiple instances of the same user then it will not be possible for the same user to upload a file at exactly the same time as himself. Just a thought... Mikey > -Original Message- > From: Richard Davey [mailto:[EMAIL PROTECTED] > Sent: 30 March 2005 19:19 > To: php-general@lists.php.net > Subject: Re[6]: [PHP] asking comment > > Hello Jared, > > Wednesday, March 30, 2005, 7:02:58 PM, you wrote: > > JW> I'll take absolutely bullet-proof and handled/supressed warnings, > JW> over relatively bullet-proof. > > That would be fine if your previous solution was absolutely > bullet-proof, or for that matter provided a solution for the > original problem of renaming uploaded files and keeping them > unique. Appending a datetime to a file, or using a loop that > hopes you get a unique name within 100 iterations is wildly > far from "bullet proof" in just about every respect. > > Best regards, > > Richard Davey > -- > http://www.launchcode.co.uk - PHP Development Services "I > do not fear computers. I fear the lack of them." - Isaac Asimov > > -- > 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] Include file
>>> xfedex wrote: Welli have a 30k script, with double i get 8 or 9 seconds, with sigle i get 0.05 or 0.08 seconds. The script basically made a lot of querys, its part of a user manager module of a system im writing. <<< Could the speed have more to do with whatever database server you are using, than with PHP? I assume database since you are querying something. Just curious. And Jay: I'm using Lotus Notes R6, not much I can do about top quoting. Martin Austin xfedex <[EMAIL PROTECTED]> 03/30/2005 06:27 PM Please respond to xfedex To: php-general@lists.php.net cc: Subject:Re: [PHP] Include file On Wed, 30 Mar 2005 15:14:27 -0600, Jay Blanchard <[EMAIL PROTECTED]> wrote: > [snip] > > Why is it faster? And why should you avoid using double quotes? > > > > ..."Scripts using single quotes run slightly faster because the PHP > parser can include the string directly. Double quoted strings are > slower because they need to be parsed."... > > Quoted from: > http://www.zend.com/zend/tut/using-strings.php?article=using-strings&kin > d=t&id=1399&open=1&anc=0&view=1 > [/snip] > > I try to use both types of quotes in the proper circumstance. Having > said that, I came to computing in the age where we worried over CPU > cycles, but I don't see how in this day and age the difference between > the two would even matter. Even on a high load site the difference > between the two would be negligible. > Welli have a 30k script, with double i get 8 or 9 seconds, with sigle i get 0.05 or 0.08 seconds. The script basically made a lot of querys, its part of a user manager module of a system im writing. Remember, the hole world is not US or EUi live in argentina and my web server is a PIII 550Mhz 128mb and if you count that almost the half of the people got a 56k dialup connectionI think that in some cases it does make difference. sorry my englishtoo taired to worry meatbread. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] functions vs classes
I know I sure appreciate reading any discussions on OOP issues, as they are something I just cannot seem to grasp. Thanks! Martin Austin Brent Baisley <[EMAIL PROTECTED]> 04/04/2005 08:44 AM To: DuSTiN KRySaK <[EMAIL PROTECTED]> cc: PHP Subject:Re: [PHP] functions vs classes At the most basic level a class allows you to group your functions together. On small projects, grouping of functions may not seem to buy you anything. But the bigger the project gets, the more you would like to be able to keep your functions separated into groups. One simple advantage of classes is that they prevent naming conflicts with your functions. This is very important when you are sharing code since you don't know what another programmer named their functions. What if you both name a function "get_one_record"? If you use classes, you only need to keep the names of your classes unique. Which then means you can use the same generic function name across all your classes, and you interface within your classes in a consistent manner, only the context changes. For instance, you may have a class call "companies" and another called "contacts". Within each you may have functions called "get_list", "get_one" and "delete_one". Same function names, but in different classes so they don't conflict. Now you could create a generic interface to view a list, view a record or delete a record. What data is displayed depends on which class you load. The function names are all the same, so you don't need to change your code when you change the context (companies or contacts). This is hardly a tutorial on OOP. But maybe it will give you an idea of the benefits of using classes. On Apr 4, 2005, at 12:28 AM, DuSTiN KRySaK wrote: > Novice PHPer, and i am wondering why one would use a function instead > of a class (or object)? They seem to server very similar in use. > > The way I see it, is a function if for repeated use in a project > specific manner, where as a class could be used for many projects. > > is this correct? > > Although one could just include the function library in multiple > projects. > > Thanks! > > Dustin > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Brent Baisley Systems Architect Landover Associates, Inc. Search & Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Header issues
Perhaps you can do some juggling to make this work, passing the query to the server, then using a client side language to transmit those results to the appropriate frame. Sounds like a big headache to me though. Martin Austin John Nichel <[EMAIL PROTECTED]> 04/05/2005 11:17 AM To: php-general@lists.php.net cc: Subject:Re: [PHP] Header issues Mahmoud Badreddine wrote: > I have a web-page divided into two frames : "margin" and "main". > Inside the "margin" frame area, I have a pull-down menu that lists all > the tables in my database. > Upon choosing the appropriate table from the pull-down menu I click a > button to display the table. > I use the Header( ) function. > This works, except that my tables are displayed in the "margin" area. > How can I force it to send to the main area , using the header function. You can't. Not using header() at least. header() happens on the server, targeting a frame happens in the client. -- 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