Re: [PHP] best way for PHP page
On Jan 1, 2008 11:17 PM, Alain Roger [EMAIL PROTECTED] wrote: Hi, i would like to improve my coding quality when i use PHP code and for that i would request your help. in my web developer experience, i have to confess that i've never succeeded in spliting PHP code from HTML code. i mean that all my web pages consist of PHP code mixed with HTML code (for rendering pages). Some developers tell it's possible to write only PHP code for web page. i agree with them but only when those PHP pages do not render web elements (write text, display pictures, display formular, ...). the purpose of my post is to know if i can really (at 100%) split client code (display images, write text,...) from server code (move or copy data to DB, create connection objects,...) so what do you think about that ? -- Alain Windows XP SP2 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008 Yes, you can. function foo() { global $data; //Fetch from database, format, etc. etc. //Stuff all the data into $data variable } function bar() { global $data; //Output with HTML } $data = array(); foo(); bar(); I'm pretty sure this is what they mean. -Casey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] best way for PHP page
On Wednesday 02 January 2008 09:17:50 Alain Roger wrote: Hi, i would like to improve my coding quality when i use PHP code and for that i would request your help. in my web developer experience, i have to confess that i've never succeeded in spliting PHP code from HTML code. i mean that all my web pages consist of PHP code mixed with HTML code (for rendering pages). Some developers tell it's possible to write only PHP code for web page. i agree with them but only when those PHP pages do not render web elements (write text, display pictures, display formular, ...). the purpose of my post is to know if i can really (at 100%) split client code (display images, write text,...) from server code (move or copy data to DB, create connection objects,...) so what do you think about that ? Hello, I believe TYPO3 has good implementation about splitting code and template. And to archieve clean php code. 1-) Left html ?php echo $this; ?/html model development 2-) Find good template engine. (no not that smarty, it was too big) 3-) use strict dicipline to move html to outside of the code. Also if you can use the php based template files you can lift off the template overhead. like. template.php $strPage = html head. title.$strPageTitle./title /head body table tr td.$strLeftBlock./td td.$strRigthBlock./td /tr /table /body /html; process.php $strPageTitle = getPageTitle($_REQUEST['page']); $strLeftBlock = getPageBlock($_REQUEST['page'],'left'); $strRightBlock = getPageBlock($_REQUEST['page'],'right'); include('template.php'); echo $strPage; regards Sancar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Wrong parameter count for imap_open()
I'm running PHP 5.2.4 and getting the error: *Warning*: Wrong parameter count for imap_open() in */var/www/sites/intra-test/contract/login.php* on line *9 *My code is: $mbox = imap_open(\{mail.mdah.state.ms.us/imap/novalidate-cert:143}INBOX\, \.$_POST[username].\, \.$_POST[password].\); // line 9 but when I echo it out, it looks fine: echo \{mail.mdah.state.ms.us/imap/novalidate-cert:143}INBOX\, \.$_POST[username].\, \.$_POST[password].\; prints: {mail.mdah.state.ms.us/imap/novalidate-cert:143}INBOX, awilliam, xxx any ideas? * *
Re: [PHP] best way for PHP page
i would like to improve my coding quality when i use PHP code and for that i would request your help. in my web developer experience, i have to confess that i've never succeeded in spliting PHP code from HTML code. There's a myth that by separating html and php your code is cleaner, it's a little more than that. What you should consider doing is separating the business logic from the display logic. The business logic includes things like database calls, data calculations, etc. Display logic is what the page actually looks like. This will likely include both HTML and PHP, but the PHP will be limited to echoing out variables, as you should have already done all calculations. One very good way to do this separation is by using the MVC pattern - http://en.wikipedia.org/wiki/Model-view-controller . I've found that using the MVC pattern helps me to write cleaner, more maintainable code as you always know where the code for a given function is located. Need to edit what the page looks like? It's in the view. Need to edit your database calls? It's in the model. Anything else? It's in the controller. There are lots of great frameworks out there that use the MVC pattern. Personally I use and recommend CodeIgniter (http:// www.codeigniter.com) - it's been a great one for me, but there are plenty of other well written frameworks out there if CodeIgniter isn't a good fit for you. HTH, Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Wrong parameter count for imap_open()
On Jan 2, 2008 10:00 AM, Adam Williams [EMAIL PROTECTED] wrote: I'm running PHP 5.2.4 and getting the error: *Warning*: Wrong parameter count for imap_open() in */var/www/sites/intra-test/contract/login.php* on line *9 *My code is: $mbox = imap_open(\{mail.mdah.state.ms.us/imap/novalidate-cert:143}INBOX\, \.$_POST[username].\, \.$_POST[password].\); // line 9 [snip!] You just forgot to encapsulate your parameters properly. You escape the strings, but don't close the parameter, so PHP reads that all as one parameter passed to imap_open(). Change it to one of the following: $mbox = imap_open(\{mail.mdah.state.ms.us/imap/novalidate-cert:143}INBOX\,\.$_POST[username].\,\.$_POST[password].\); // line 9 OR $mbox = imap_open('{mail.mdah.state.ms.us/imap/novalidate-cert:143}INBOX',''.$_POST['username'].'','.$_POST['password'].''); -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] best way for PHP page
On Jan 2, 2008 2:17 AM, Alain Roger [EMAIL PROTECTED] wrote: Hi, i would like to improve my coding quality when i use PHP code and for that i would request your help. in my web developer experience, i have to confess that i've never succeeded in spliting PHP code from HTML code. i mean that all my web pages consist of PHP code mixed with HTML code (for rendering pages). Some developers tell it's possible to write only PHP code for web page. i agree with them but only when those PHP pages do not render web elements (write text, display pictures, display formular, ...). the purpose of my post is to know if i can really (at 100%) split client code (display images, write text,...) from server code (move or copy data to DB, create connection objects,...) so what do you think about that ? study up on mvc http://en.wikipedia.org/wiki/Model-view-controller then look at some of the popular open source php implementations. code igniter is very thin and straightforward. you can quickly see how a php application can be separated into layers. -nathan
Re: [PHP] best way for PHP page
If MVC is too heavy for you it may also be worth exploring templating engines such as Smarty: http://www.smarty.net/ On Jan 2, 2008 4:10 PM, Nathan Nobbe [EMAIL PROTECTED] wrote: On Jan 2, 2008 2:17 AM, Alain Roger [EMAIL PROTECTED] wrote: Hi, i would like to improve my coding quality when i use PHP code and for that i would request your help. in my web developer experience, i have to confess that i've never succeeded in spliting PHP code from HTML code. i mean that all my web pages consist of PHP code mixed with HTML code (for rendering pages). Some developers tell it's possible to write only PHP code for web page. i agree with them but only when those PHP pages do not render web elements (write text, display pictures, display formular, ...). the purpose of my post is to know if i can really (at 100%) split client code (display images, write text,...) from server code (move or copy data to DB, create connection objects,...) so what do you think about that ? study up on mvc http://en.wikipedia.org/wiki/Model-view-controller then look at some of the popular open source php implementations. code igniter is very thin and straightforward. you can quickly see how a php application can be separated into layers. -nathan
[PHP] automatic caller
I'm working on a prototype now and was wondering if anyone new of a service where I could pass in text and a number and the service would call the number and read the text. I know I can do this with asterisk and it's php api but don't have time to set up all the outgoing code/functionality. Does anyone know of a service that does this so I can show it as a proof of concept. I looked at GrandCentral but it doesn't appear to have this feature. Thanks!
Re: [PHP] Wrong parameter count for imap_open()
Adam Williams wrote: I'm running PHP 5.2.4 and getting the error: *Warning*: Wrong parameter count for imap_open() in */var/www/sites/intra-test/contract/login.php* on line *9 *My code is: $mbox = imap_open(\{mail.mdah.state.ms.us/imap/novalidate-cert:143}INBOX\, \.$_POST[username].\, \.$_POST[password].\); // line 9 From the documentation, it looks to me like you are makings things much more complicated then they need to be. imap_open('{mail.mdah.state.ms.us/imap/novalidate-cert:143}INBOX', $_POST[username], $_POST[password]); From what the documentation shows, you do not need to have quotes around the username/password fields. Enjoy. but when I echo it out, it looks fine: echo \{mail.mdah.state.ms.us/imap/novalidate-cert:143}INBOX\, \.$_POST[username].\, \.$_POST[password].\; prints: {mail.mdah.state.ms.us/imap/novalidate-cert:143}INBOX, awilliam, xxx any ideas? * * -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] automatic caller
On Jan 2, 2008 12:23 PM, blackwater dev [EMAIL PROTECTED] wrote: I'm working on a prototype now and was wondering if anyone new of a service where I could pass in text and a number and the service would call the number and read the text. I know I can do this with asterisk and it's php api but don't have time to set up all the outgoing code/functionality. Does anyone know of a service that does this so I can show it as a proof of concept. I looked at GrandCentral but it doesn't appear to have this feature. im wondering if it would be prudent for a service to allow you to call just any number? obviously a company A providing service to company B could supply a service to company B to call any number at company B, no sweat. there could also be an SLA that defines misuse of the service; like if company B is spamming some people or w/e, then company A defers responsibility to them legally. but im guessing there could be some legal implications regarding a generic service to call any number.. anyway this is all just speculation :O -nathan
[PHP] First stupid post of the year.
Hi gang: I have a $submit = $_POST['submit']; The string contains: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; (it's there to make a submit button wider) How can I strip out the nbsp; from the $submit string leaving A? I've tried trim($submit); but, that don't work. Neither does: $submit = str_replace('nbsp;','',$submit); or this: $submit = str_replace(' ';','',$submit); I should know what to do, but in this case I don't. Help is always appreciated. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
On Jan 2, 2008 1:34 PM, tedd [EMAIL PROTECTED] wrote: Hi gang: I have a $submit = $_POST['submit']; The string contains: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; (it's there to make a submit button wider) How can I strip out the nbsp; from the $submit string leaving A? I've tried trim($submit); but, that don't work. Neither does: $submit = str_replace('nbsp;','',$submit); or this: $submit = str_replace(' ';','',$submit); I should know what to do, but in this case I don't. Help is always appreciated. why dont you just style the button w/ css? style=width:200px -nathan
Re: [PHP] best way for PHP page
At 8:17 AM +0100 1/2/08, Alain Roger wrote: the purpose of my post is to know if i can really (at 100%) split client code (display images, write text,...) from server code (move or copy data to DB, create connection objects,...) so what do you think about that ? Alain: What do I think about that? I think there is only one web language and it's called php/mysql/html/js/css. For no one language can do it all. The bigger point is to learn how to separate data, presentation, and functionality. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
On 1/2/08, Nathan Nobbe [EMAIL PROTECTED] wrote: On Jan 2, 2008 1:34 PM, tedd [EMAIL PROTECTED] wrote: Hi gang: I have a $submit = $_POST['submit']; The string contains: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; (it's there to make a submit button wider) How can I strip out the nbsp; from the $submit string leaving A? I've tried trim($submit); but, that don't work. Neither does: $submit = str_replace('nbsp;','',$submit); or this: $submit = str_replace(' ';','',$submit); I should know what to do, but in this case I don't. Help is always appreciated. why dont you just style the button w/ css? style=width:200px -nathan Parse the string character by character discarding '' , 'n' , 'b' , 's' , 'p' , and ';'. Assuming of course that the part of the label you want to keep is none of those characters. -David
Re: [PHP] First stupid post of the year.
At 1:46 PM -0500 1/2/08, Nathan Nobbe wrote: On Jan 2, 2008 1:34 PM, tedd mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; (it's there to make a submit button wider) why dont you just style the button w/ css? style=width:200px -nathan -nathan: Have you tried that? I have, and it don't work. I can create wider buttonwhatever/button but I cannot create a wider input type=submit value=A submit button. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] First stupid post of the year.
I often identify each of my submit buttons with different names and identify which one was pressed by; If(isset($_POST[submit1])) Only one will ever be pressed at a time, and that allows me to use the same page with multiple languages (substituting different values for different languages). As you can see I can ignore the value, and submit buttons are not sent in the form if they are not clicked. Another option, Warren Vail -Original Message- From: Nathan Nobbe [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 02, 2008 10:46 AM To: tedd Cc: PHP General list Subject: Re: [PHP] First stupid post of the year. On Jan 2, 2008 1:34 PM, tedd [EMAIL PROTECTED] wrote: Hi gang: I have a $submit = $_POST['submit']; The string contains: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; (it's there to make a submit button wider) How can I strip out the nbsp; from the $submit string leaving A? I've tried trim($submit); but, that don't work. Neither does: $submit = str_replace('nbsp;','',$submit); or this: $submit = str_replace(' ';','',$submit); I should know what to do, but in this case I don't. Help is always appreciated. why dont you just style the button w/ css? style=width:200px -nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
On Jan 2, 2008 1:34 PM, tedd [EMAIL PROTECTED] wrote: Hi gang: I have a $submit = $_POST['submit']; The string contains: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; (it's there to make a submit button wider) How can I strip out the nbsp; from the $submit string leaving A? I've tried trim($submit); but, that don't work. Neither does: $submit = str_replace('nbsp;','',$submit); or this: $submit = str_replace(' ';','',$submit); I should know what to do, but in this case I don't. Help is always appreciated. ? // Your existing code here $submit = trim(str_replace('nbsp;','',$submit); ? -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
On Jan 2, 2008 1:55 PM, tedd [EMAIL PROTECTED] wrote: At 1:46 PM -0500 1/2/08, Nathan Nobbe wrote: On Jan 2, 2008 1:34 PM, tedd mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; (it's there to make a submit button wider) why dont you just style the button w/ css? style=width:200px -nathan -nathan: Have you tried that? I have, and it don't work. I can create wider buttonwhatever/button but I cannot create a wider input type=submit value=A submit button. it appears to work for me using firefox: html head title /title /head body form input type=submit style=width:250px value=Submit form /body /html -nathan
Re: [PHP] First stupid post of the year.
On Jan 2, 2008 1:55 PM, tedd [EMAIL PROTECTED] wrote: At 1:46 PM -0500 1/2/08, Nathan Nobbe wrote: On Jan 2, 2008 1:34 PM, tedd mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; (it's there to make a submit button wider) why dont you just style the button w/ css? style=width:200px -nathan -nathan: Have you tried that? I have, and it don't work. I can create wider buttonwhatever/button but I cannot create a wider input type=submit value=A submit button. Try this: input type=submit value=A style=width:160px;align:center;text-align:center; -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
tedd wrote: At 1:46 PM -0500 1/2/08, Nathan Nobbe wrote: On Jan 2, 2008 1:34 PM, tedd mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; (it's there to make a submit button wider) why dont you just style the button w/ css? style=width:200px -nathan -nathan: Have you tried that? I have, and it don't work. I can create wider buttonwhatever/button but I cannot create a wider input type=submit value=A submit button. Cheers, tedd Yes you can: input type=submit value=A style=width: 25px; height: 10px; -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
Add it inline, and it'll override everything else. input type=submit style=width: 200px; name=bob / tedd wrote: At 1:46 PM -0500 1/2/08, Nathan Nobbe wrote: On Jan 2, 2008 1:34 PM, tedd mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; (it's there to make a submit button wider) why dont you just style the button w/ css? style=width:200px -nathan -nathan: Have you tried that? I have, and it don't work. I can create wider buttonwhatever/button but I cannot create a wider input type=submit value=A submit button. Cheers, tedd
Re: [PHP] First stupid post of the year.
At 1:57 PM -0500 1/2/08, Daniel Brown wrote: On Jan 2, 2008 1:34 PM, tedd [EMAIL PROTECTED] wrote: from this: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; to this A ? // Your existing code here $submit = trim(str_replace('nbsp;','',$submit); ? Even with adding an additional ), that didn't work either. :-) Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
Nathan Nobbe wrote: On Jan 2, 2008 1:55 PM, tedd [EMAIL PROTECTED] wrote: At 1:46 PM -0500 1/2/08, Nathan Nobbe wrote: On Jan 2, 2008 1:34 PM, tedd mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; (it's there to make a submit button wider) why dont you just style the button w/ css? style=width:200px -nathan -nathan: Have you tried that? I have, and it don't work. I can create wider buttonwhatever/button but I cannot create a wider input type=submit value=A submit button. it appears to work for me using firefox: html head title /title /head body form input type=submit style=width:250px value=Submit form /body /html -nathan I prefer this approach instead. html head title/title style button, input[type=submit], input[type=reset], input[type=button] { width: 250px; } /style /head body form input type=submit value=Submit form /body /html This way, you hit all your buttons with one style tag. -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
i wonder what the record will be this year for the number of identical responses to a question in a single thread ;) looks like this one is already out in front! -nathan
Re: [PHP] First stupid post of the year.
On Jan 2, 2008 2:05 PM, tedd [EMAIL PROTECTED] wrote: At 1:57 PM -0500 1/2/08, Daniel Brown wrote: On Jan 2, 2008 1:34 PM, tedd [EMAIL PROTECTED] wrote: from this: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; to this A ? // Your existing code here $submit = trim(str_replace('nbsp;','',$submit); ? Even with adding an additional ), that didn't work either. :-) That was a typo on my part, but check it out here and you'll see it works (you can view full source there, too): http://pilotpig.net/code-library/tedds-button.php -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] First stupid post of the year.
if you need to make the button wider, just style it with css and leave the value to be what it needs to be input type='text' width='100px' value='Submit' name='submit' Date: Wed, 2 Jan 2008 13:34:43 -0500 To: php-general@lists.php.net From: [EMAIL PROTECTED] Subject: [PHP] First stupid post of the year. Hi gang: I have a $submit = $_POST['submit']; The string contains: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; (it's there to make a submit button wider) How can I strip out the nbsp; from the $submit string leaving A? I've tried trim($submit); but, that don't work. Neither does: $submit = str_replace('nbsp;','',$submit); or this: $submit = str_replace(' ';','',$submit); I should know what to do, but in this case I don't. Help is always appreciated. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Use fowl language with Chicktionary. Click here to start playing! http://puzzles.sympatico.msn.ca/chicktionary/index.html?icid=htmlsig
Re: [PHP] First stupid post of the year.
On Jan 2, 2008 2:05 PM, tedd [EMAIL PROTECTED] wrote: At 1:57 PM -0500 1/2/08, Daniel Brown wrote: On Jan 2, 2008 1:34 PM, tedd [EMAIL PROTECTED] wrote: from this: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; to this A ? // Your existing code here $submit = trim(str_replace('nbsp;','',$submit); ? Even with adding an additional ), that didn't work either. :-) first off; i think css is the way to go w/ this; to save yourself from these headaches. anyway; if you want to go this route, i think there is some info we are missing. im guessing you dont have the nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; in the submit button itself, or do you? i certainly dont know what the point of that would be since users wont change the value attribute of a submit button anyway. so can we see the html for the input that contains the nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; or maybe this is the first stupid response of the year! -nathan
Re: [PHP] First stupid post of the year.
Hi gang: My apologies to all who responded with a css solution -- css DOES indeed work!. I went from using button tags, which could be styled, but IE had problems with them -- to using submit buttons that IE could use, but my css no longer worked. The reason why my css no longer worked was I used: button {width:5em;} instead of: .button {width:5em;} A little id v class problem. BUT, while I don't need the solution any longer to strip out nbsp; from a string, the question still remains -- how do you do that? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
On Jan 2, 2008 2:10 PM, Jim Lucas [EMAIL PROTECTED] wrote: I prefer this approach instead. html head title/title style button, input[type=submit], input[type=reset], input[type=button] { width: 250px; } /style /head body form input type=submit value=Submit form /body /html The problem is that it will force that style on all buttons where that CSS is present. With Tedd's particular request, I don't think he needs (or especially wants) that portability. This would be one of the only instances, though, where Jim's response may not be the best. In most other cases, that would be the most economic way. -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
Nathan Nobbe wrote: i wonder what the record will be this year for the number of identical responses to a question in a single thread ;) looks like this one is already out in front! -nathan problem is, most of the responses have not answered the OP's inital question. It wasn't about style it wider, it was about removing characters from a string. -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
tedd wrote: Hi gang: I have a $submit = $_POST['submit']; The string contains: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; (it's there to make a submit button wider) How can I strip out the nbsp; from the $submit string leaving A? I've tried trim($submit); but, that don't work. Neither does: $submit = str_replace('nbsp;','',$submit); or this: $submit = str_replace(' ';','',$submit); I should know what to do, but in this case I don't. Help is always appreciated. Cheers, tedd The problem is, is that you are not getting nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; when you submit your form. It is being URL encoded by the browser and you are actually getting amp;nbsp;%20amp;nbsp;%20amp;nbsp;%20amp;nbsp;Aamp;nbsp;%20amp;nbsp;%20amp;nbsp;%20amp;nbsp; So, what you need to do is this $submit = urldecode($submit);// This will take care of the %20 for spaces $submit = str_replace('amp;nbsp;','',$submit); // This takes out the encoded entities That should take care of your problem. Here is a note from teh html_entity_decode page: Note: You might wonder why trim(html_entity_decode('nbsp;')); doesn't reduce the string to an empty string, that's because the 'nbsp;' entity is not ASCII code 32 (which is stripped by trim()) but ASCII code 160 (0xa0) in the default ISO 8859-1 characterset. /note So, you might try replacing the nbsp; with ASCII 160 char. I found that if you hold down the alt key and press 160 on your keyboard, it will create that char for you. you could also do a chr(160) and get it in PHP. -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
tedd wrote: Hi gang: I have a $submit = $_POST['submit']; The string contains: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; (it's there to make a submit button wider) How can I strip out the nbsp; from the $submit string leaving A? I've tried trim($submit); but, that don't work. Neither does: $submit = str_replace('nbsp;','',$submit); or this: $submit = str_replace(' ';','',$submit); I should know what to do, but in this case I don't. Help is always appreciated. Just so we have all the info, why are you wanting to do this? Why not just have the button text be what you want it instead of trying to do manipulation on it's value? -- Jack Mays -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
At 2:18 PM -0500 1/2/08, Daniel Brown wrote: On Jan 2, 2008 2:05 PM, tedd [EMAIL PROTECTED] wrote: At 1:57 PM -0500 1/2/08, Daniel Brown wrote: On Jan 2, 2008 1:34 PM, tedd [EMAIL PROTECTED] wrote: from this: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; to this A ? // Your existing code here $submit = trim(str_replace('nbsp;','',$submit); ? Even with adding an additional ), that didn't work either. :-) That was a typo on my part, but check it out here and you'll see it works (you can view full source there, too): http://pilotpig.net/code-library/tedds-button.php If you look , you will see that your: $submit = trim(str_replace('nbsp;','',$submit); does not strip out the nbsp; from the string. B remains with spaces on either side -- at least on my browser. However, the css style A button works great. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
Daniel Brown wrote: On Jan 2, 2008 2:05 PM, tedd [EMAIL PROTECTED] wrote: At 1:57 PM -0500 1/2/08, Daniel Brown wrote: On Jan 2, 2008 1:34 PM, tedd [EMAIL PROTECTED] wrote: from this: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; to this A ? // Your existing code here $submit = trim(str_replace('nbsp;','',$submit); ? Even with adding an additional ), that didn't work either. :-) That was a typo on my part, but check it out here and you'll see it works (you can view full source there, too): http://pilotpig.net/code-library/tedds-button.php Since you don't use nbsp; any more input type=submit name=submit value=A style=width:160px;align:center;text-align:center; / you don't need $submit = trim(str_replace('nbsp;','',$submit)); right? Also (fine tuning :)), I think you don't need whole ... style=width:160px;align:center;text-align:center; / Just ... style=width:160px; / because it's form button and it's by default already centered. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
Daniel Brown wrote: On Jan 2, 2008 2:05 PM, tedd [EMAIL PROTECTED] wrote: At 1:57 PM -0500 1/2/08, Daniel Brown wrote: On Jan 2, 2008 1:34 PM, tedd [EMAIL PROTECTED] wrote: from this: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; to this A ? // Your existing code here $submit = trim(str_replace('nbsp;','',$submit); Read the docs for trim, you can't use it inline with other functions, it will not trim the input. you have to seperate it out, e.g.: $submit = str_replace('nbsp;','',$submit); $submit = trim($submit); ? Even with adding an additional ), that didn't work either. :-) That was a typo on my part, but check it out here and you'll see it works (you can view full source there, too): http://pilotpig.net/code-library/tedds-button.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
don't use nonbreaking spaces use CSS to style the input button then you wont have to deal with redundant presentational gunk in your data On 1/2/08, David Giragosian [EMAIL PROTECTED] wrote: On 1/2/08, Nathan Nobbe [EMAIL PROTECTED] wrote: On Jan 2, 2008 1:34 PM, tedd [EMAIL PROTECTED] wrote: Hi gang: I have a $submit = $_POST['submit']; The string contains: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; (it's there to make a submit button wider) How can I strip out the nbsp; from the $submit string leaving A? I've tried trim($submit); but, that don't work. Neither does: $submit = str_replace('nbsp;','',$submit); or this: $submit = str_replace(' ';','',$submit); I should know what to do, but in this case I don't. Help is always appreciated. why dont you just style the button w/ css? style=width:200px -nathan Parse the string character by character discarding '' , 'n' , 'b' , 's' , 'p' , and ';'. Assuming of course that the part of the label you want to keep is none of those characters. -David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
On Jan 2, 2008 2:27 PM, Jim Lucas [EMAIL PROTECTED] wrote: Nathan Nobbe wrote: i wonder what the record will be this year for the number of identical responses to a question in a single thread ;) looks like this one is already out in front! -nathan problem is, most of the responses have not answered the OP's inital question. It wasn't about style it wider, it was about removing characters from a string. sometimes you have to realize the current solution may not be the best. if you realize this issue could be dealt w/ by using css then all the string filtering nonsense becomes irrelevant. and yes several people posted nearly identical solutions. i know its futile to complain, sort of like the [SOLVED] thing we discussed a while back. well i just find it annoying when people dont bother to read through the currently posted solutions before posting the exact same thing or nearly identical thing themselves. if i were to post something nearly identical to a previously posted solution, i would preface it with an explanation, here is why, although a similar solution was posted, this subsequent post is relevant anyway thats my little rant and now that ive said it; now ill go on ignoring it.. -nathan
Re: [PHP] First stupid post of the year.
On Jan 2, 2008 1:26 PM, afan pasalic [EMAIL PROTECTED] wrote: Since you don't use nbsp; any more input type=submit name=submit value=A style=width:160px;align:center;text-align:center; / you don't need $submit = trim(str_replace('nbsp;','',$submit)); right? Negative. That was to show how Form B is handled. Also (fine tuning :)), I think you don't need whole ... style=width:160px;align:center;text-align:center; / Just ... style=width:160px; / because it's form button and it's by default already centered. You're right about that part, I just typed it by force of habit. -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
At 11:27 AM -0800 1/2/08, Jim Lucas wrote: The problem is, is that you are not getting Apparently, that makes two of us. :-) nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; when you submit your form. It is being URL encoded by the browser and you are actually getting amp;nbsp;%20amp;nbsp;%20amp;nbsp;%20amp;nbsp;Aamp;nbsp;%20amp;nbsp;%20amp;nbsp;%20amp;nbsp; So, what you need to do is this $submit = urldecode($submit);// This will take care of the %20 for spaces $submit = str_replace('amp;nbsp;','',$submit); // This takes out the encoded entities That should take care of your problem. Good idea, but it still don't work -- try it. Thanks. tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
At 2:22 PM -0500 1/2/08, Nathan Nobbe wrote: first off; i think css is the way to go w/ this; -snip No, you are absolutely correct. The problem was that I was in a rush and forgot that I had used a class but had defined an id in my css. or maybe this is the first stupid response of the year! -nathan Not at all -- your post forced me to try the concept in-line and when I saw it worked, then I went back to my css sheet to find out why it didn't before. Just one of those things. However, I still have not been able to remove nbsp; from a string. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
echo trim(str_replace('nbsp;', '', $submit); On Wed, January 2, 2008 12:34 pm, tedd wrote: Hi gang: I have a $submit = $_POST['submit']; The string contains: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; (it's there to make a submit button wider) How can I strip out the nbsp; from the $submit string leaving A? I've tried trim($submit); but, that don't work. Neither does: $submit = str_replace('nbsp;','',$submit); or this: $submit = str_replace(' ';','',$submit); I should know what to do, but in this case I don't. Help is always appreciated. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
On Wed, January 2, 2008 1:27 pm, Jim Lucas wrote: The string contains: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; The problem is, is that you are not getting nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; when you submit your form. It is being URL encoded by the browser and you are actually getting amp;nbsp;%20amp;nbsp;%20amp;nbsp;%20amp;nbsp;Aamp;nbsp;%20amp;nbsp;%20amp;nbsp;%20amp;nbsp; But that is URL *DE*-coded by PHP internally before it's crammed into $_POST/$_GET/$_COOKIES! -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
At 11:27 AM -0800 1/2/08, Jim Lucas wrote: Note: You might wonder why trim(html_entity_decode('nbsp;')); doesn't reduce the string to an empty string, that's because the 'nbsp;' entity is not ASCII code 32 (which is stripped by trim()) but ASCII code 160 (0xa0) in the default ISO 8859-1 characterset. Ah, that answers a question I posed last week about a gremlin appearing in a string. In a text file,via a Hex Editor it was 0A, but on the server it was 160 with some other character. Now, it makes sense. Thanks, ted -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
On Wed, January 2, 2008 1:25 pm, Jack Mays wrote: Daniel Brown wrote: // Your existing code here $submit = trim(str_replace('nbsp;','',$submit); Read the docs for trim, you can't use it inline with other functions, Please point to the specific portion of the docs in which you imagine this to be written... :-) And, technically, if you are CERTAIN the button value will never ever contain any of the characters '', 'n', 'b', 's', ';' then you could use the new second arg of trim to do: $submit = trim($_POST['submit'], nbsp;\r\n\t\x0b\0); and get rid of all whitespace and the 'nbsp;' as well... Probably NOT a Good Idea in general, however... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Wrong parameter count for imap_open()
On Wed, January 2, 2008 9:00 am, Adam Williams wrote: I'm running PHP 5.2.4 and getting the error: *Warning*: Wrong parameter count for imap_open() in */var/www/sites/intra-test/contract/login.php* on line *9 *My code is: $mbox = imap_open(\{mail.mdah.state.ms.us/imap/novalidate-cert:143}INBOX\, \.$_POST[username].\, \.$_POST[password].\); // line 9 This creates a single string which LOOKS like what you should have typed in the first place. but when I echo it out, it looks fine: echo \{mail.mdah.state.ms.us/imap/novalidate-cert:143}INBOX\, \.$_POST[username].\, \.$_POST[password].\; prints: {mail.mdah.state.ms.us/imap/novalidate-cert:143}INBOX, awilliam, xxx You need to END the quote for the Mailbox before you put in a comma to separate the mailbox arg from the username arg. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
At 1:29 PM -0600 1/2/08, Jack Mays wrote: Just so we have all the info, why are you wanting to do this? Why not just have the button text be what you want it instead of trying to do manipulation on it's value? Why? It was just a mistaken assumption that I could not style a submit button and instead used nbsp;'s to make the button wider. After which, I would simply remove the spaces before submitting them to a switch/case condition. There is nothing wrong with my logic, it was an error in my css. People use submit buttons lot's of different ways and there is no one correct way. But, as far as I am concerned, the value of a submit button is what I'm after, so doing something like this: input type=submit class=button name=submit value=A input type=submit class=button name=submit value=B ... followed by: $submit = $_POST['submit']; switch $submit { case 'A': do something; break; case 'B': do something else; break; ... } is a good way to handle user input. I see no fault in logic. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
At 11:10 AM -0800 1/2/08, Jim Lucas wrote: I prefer this approach instead. html head title/title style button, input[type=submit], input[type=reset], input[type=button] { width: 250px; } /style /head body form input type=submit value=Submit form /body /html I prefer this: in css .button { width: 5em; } in html input type=submit class=button name=submit valueA Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
At 1:25 PM -0600 1/2/08, Jack Mays wrote: On Jan 2, 2008 1:34 PM, tedd [EMAIL PROTECTED] wrote: from this: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; to this A Read the docs for trim, you can't use it inline with other functions, it will not trim the input. you have to seperate it out, e.g.: $submit = str_replace('nbsp;','',$submit); $submit = trim($submit); But, that still doesn't work. Go from here: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; to here: A Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
At 7:36 PM + 1/2/08, Dave Goodchild wrote: don't use nonbreaking spaces use CSS to style the input button then you wont have to deal with redundant presentational gunk in your data OK! But, do you have a solution to the original question? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
tedd [EMAIL PROTECTED] wrote: Hi gang: I have a $submit = $_POST['submit']; The string contains: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; (it's there to make a submit button wider) How can I strip out the nbsp; from the $submit string leaving A? I've tried trim($submit); but, that don't work. Neither does: $submit = str_replace('nbsp;','',$submit); or this: $submit = str_replace(' ';','',$submit); I should know what to do, but in this case I don't. Help is always appreciated. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php input type=text value=A size=50 input type=submit Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
At 2:36 PM -0500 1/2/08, Nathan Nobbe wrote: and yes several people posted nearly identical solutions. i know its futile to complain, sort of like the [SOLVED] thing we discussed a while back. well i just find it annoying when people dont bother to read through the currently posted solutions before posting the exact same thing or nearly identical thing themselves. Yeah, but what's the fun in doing it that way? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
tedd wrote: However, I still have not been able to remove nbsp; from a string. IThe trim(str_replace('nbsp;','',$submit)); seems to work fine for me when I assign the string from your message to $submit. Copy/pasted it. Have you looked at $submit with var_dump before you tried to change it? Perhaps it does not contain what you think it does. Janet Cheers, tedd -- janet.valade.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
tedd [EMAIL PROTECTED] wrote: At 1:25 PM -0600 1/2/08, Jack Mays wrote: On Jan 2, 2008 1:34 PM, tedd [EMAIL PROTECTED] wrote: from this: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; to this A Read the docs for trim, you can't use it inline with other functions, it will not trim the input. you have to seperate it out, e.g.: $submit = str_replace('nbsp;','',$submit); $submit = trim($submit); But, that still doesn't work. Go from here: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; to here: A Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php $string=nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp;; $string=str_replace(nbsp;,,$string); $string=ltrim(rtrim($string))); echo The string is now:$string\n; Outputs: The string is now:A Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
?php $foo = 'nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp;'; $foo = str_replace( 'nbsp;', ' ', $foo ); $foo = trim( ereg_replace( '[ ]+', ' ', $foo ) ); echo '['.$foo.']'.\n; ? I could have replaced 'nbsp;' with the empty string, but in case you have labels with more than one word I took a normalizing approach. Cheers, Rob. On Wed, 2008-01-02 at 13:34 -0500, tedd wrote: Hi gang: I have a $submit = $_POST['submit']; The string contains: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; (it's there to make a submit button wider) How can I strip out the nbsp; from the $submit string leaving A? I've tried trim($submit); but, that don't work. Neither does: $submit = str_replace('nbsp;','',$submit); or this: $submit = str_replace(' ';','',$submit); I should know what to do, but in this case I don't. Help is always appreciated. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
On Jan 2, 2008 12:11 PM, tedd [EMAIL PROTECTED] wrote: At 2:36 PM -0500 1/2/08, Nathan Nobbe wrote: and yes several people posted nearly identical solutions. i know its futile to complain, sort of like the [SOLVED] thing we discussed a while back. well i just find it annoying when people dont bother to read through the currently posted solutions before posting the exact same thing or nearly identical thing themselves. Yeah, but what's the fun in doing it that way? Cheers, tedd $value = trim($value, chr(32) . chr(160)); Cookie for me? :) -- -Casey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
On Jan 2, 2008 3:16 PM, Wolf [EMAIL PROTECTED] wrote: [snip=all] Okay, first of all, Tedd's right my thing didn't work, because I had copied over a script I was working with on the CLI. Secondly, the trim() and str_replace() things work great from the CLI, but not when transmogrified by a combination of the browser, HTTP server, and PHP. Thus, the non-elegant solution that Really Works[tm] is now properly displayed: http://www.pilotpig.net/code-library/tedds-button.php It's ugly, but it does the job. Kinda' like its programmer. -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
On Wed, January 2, 2008 2:09 pm, tedd wrote: At 1:25 PM -0600 1/2/08, Jack Mays wrote: On Jan 2, 2008 1:34 PM, tedd [EMAIL PROTECTED] wrote: from this: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; to this A Read the docs for trim, you can't use it inline with other functions, it will not trim the input. you have to seperate it out, e.g.: $submit = str_replace('nbsp;','',$submit); $submit = trim($submit); But, that still doesn't work. Go from here: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; to here: A Works for me: [EMAIL PROTECTED] ~/cd $ php -a Interactive mode enabled ?php $a = 'nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp;'; $b = str_replace('nbsp;', '', $a); echo b: $b\n\n; $c = trim($b); echo c: $c\n\n; ? b:A c: A [EMAIL PROTECTED] ~/cd $ -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
On Jan 2, 2008 3:58 PM, Richard Lynch [EMAIL PROTECTED] wrote: Works for me: [EMAIL PROTECTED] ~/cd $ php -a Interactive mode enabled ?php $a = 'nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp;'; $b = str_replace('nbsp;', '', $a); echo b: $b\n\n; $c = trim($b); echo c: $c\n\n; ? b:A c: A Tedd's problem is that it's not working on the web, though, Rich. I tested mine and it worked fine from the CLI, too, but not when encoded and then decoded via HTTP. -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
On Jan 2, 2008 12:58 PM, Richard Lynch [EMAIL PROTECTED] wrote: On Wed, January 2, 2008 2:09 pm, tedd wrote: At 1:25 PM -0600 1/2/08, Jack Mays wrote: On Jan 2, 2008 1:34 PM, tedd [EMAIL PROTECTED] wrote: from this: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; to this A Read the docs for trim, you can't use it inline with other functions, it will not trim the input. you have to seperate it out, e.g.: $submit = str_replace('nbsp;','',$submit); $submit = trim($submit); But, that still doesn't work. Go from here: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; to here: A Works for me: [EMAIL PROTECTED] ~/cd $ php -a Interactive mode enabled ?php $a = 'nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp;'; $b = str_replace('nbsp;', '', $a); echo b: $b\n\n; $c = trim($b); echo c: $c\n\n; ? b:A c: A [EMAIL PROTECTED] ~/cd $ -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php OKAY. Let's clarify. Here's the string in HTML: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; The browser then passes it to GET/POST. It decodes the entities, and then urlencodes them. Now it looks like this: %a0%20%a0%20%a0%20%a0A%a0%20%a0%20%a0%20%a0 Then PHP receives it, urldecodes the string, then stuffs it inside $_POST, $_GET, $_REQUEST, etc. Now it's like this: A $_POST['submit'] == ' A ' // TRUE. ... *pokes my solution*... $value = trim($value, chr(32) . chr(160)); -- -Casey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
On Jan 2, 2008 4:08 PM, Casey [EMAIL PROTECTED] wrote: ... *pokes my solution*... $value = trim($value, chr(32) . chr(160)); You're solution is good, Casey we're just ignoring you because you smell funny. -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
On Wed, 2008-01-02 at 16:15 -0500, Daniel Brown wrote: On Jan 2, 2008 4:08 PM, Casey [EMAIL PROTECTED] wrote: ... *pokes my solution*... $value = trim($value, chr(32) . chr(160)); You're solution is good, Casey we're just ignoring you because you smell funny. Is that what that is :| I thought it was my daughter's diaper! Cheers, Rob. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Fatal error: Function name must be a string
I'm getting the following error and I don't see whats wrong with my line. Any ideas? *Fatal error*: Function name must be a string in */var/www/sites/intra-test/contract/perform.php* on line *57* and my snippet of code is: if ( $_POST[perform] == View Contracts ) { $mysqli_get_userid = SELECT user_id from user where email = '.$_SESSION[username].'; $mysqli_get_userid_result = $mysqli_query($mysqli, // line 57 $mysqli_get_userid) or die(mysqli_error($mysqli)); while ($userid_result = mysqli_fetch_array($mysqli_get_userid_result)) { $user_id = $userid_result[user_id]; } }
Re: [PHP] Fatal error: Function name must be a string
On Jan 2, 2008 4:58 PM, Adam Williams [EMAIL PROTECTED] wrote: I'm getting the following error and I don't see whats wrong with my line. Any ideas? *Fatal error*: Function name must be a string in */var/www/sites/intra-test/contract/perform.php* on line *57* and my snippet of code is: if ( $_POST[perform] == View Contracts ) { $mysqli_get_userid = SELECT user_id from user where email = '.$_SESSION[username].'; $mysqli_get_userid_result = $mysqli_query($mysqli, // line 57 $mysqli_get_userid) or die(mysqli_error($mysqli)); while ($userid_result = mysqli_fetch_array($mysqli_get_userid_result)) { $user_id = $userid_result[user_id]; } } Change: $mysqli_query($mysqli, to: mysqli_query($mysqli, Otherwise you're declaring mysqli_query() as a variable. -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Fatal error: Function name must be a string
Adam Williams wrote: I'm getting the following error and I don't see whats wrong with my line. Any ideas? *Fatal error*: Function name must be a string in */var/www/sites/intra-test/contract/perform.php* on line *57* and my snippet of code is: if ( $_POST[perform] == View Contracts ) { $mysqli_get_userid = SELECT user_id from user where email = '.$_SESSION[username].'; $mysqli_get_userid_result = $mysqli_query($mysqli, // line 57 $mysqli_get_userid) or die(mysqli_error($mysqli)); $mysqli_query should be mysqli_query (note: no $ ). You have an unset value, ie. null and you can't have a function called NULL (as the value). while ($userid_result = mysqli_fetch_array($mysqli_get_userid_result)) { $user_id = $userid_result[user_id]; } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
Richard Lynch wrote: On Wed, January 2, 2008 1:27 pm, Jim Lucas wrote: The string contains: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; The problem is, is that you are not getting nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; when you submit your form. It is being URL encoded by the browser and you are actually getting amp;nbsp;%20amp;nbsp;%20amp;nbsp;%20amp;nbsp;Aamp;nbsp;%20amp;nbsp;%20amp;nbsp;%20amp;nbsp; But that is URL *DE*-coded by PHP internally before it's crammed into $_POST/$_GET/$_COOKIES! Ok, so here is my little friend, my packet exploder... So, I wrote this packet decoder last week for a different project. Come to find out, it is a very hand little tool. Takes text input and dumps it like a normal packet analyzer application. Check out what is found. http://www.cmsws.com/examples/html/form_encoding.php This I think shows what tedd is looking for. so, from this I deduce that this should work. $submit = trim($submit, \xA0\x20); What do you guys/gals think? -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: automatic caller
blackwater dev [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I'm working on a prototype now and was wondering if anyone new of a service where I could pass in text and a number and the service would call the number and read the text. I know I can do this with asterisk and it's php api but don't have time to set up all the outgoing code/functionality. Does anyone know of a service that does this so I can show it as a proof of concept. I looked at GrandCentral but it doesn't appear to have this feature. Thanks! A simple google search for automated calling returns a lot of results, although most are services which you have to pay to use and they dont' seem like you can just call them with text but must have a pre-recorded message. Off the top of my head probably the simplest thing would be to just use the Skype API and use them for calls. Since this is just a prototype then there probably won't be many calls made on it and it should not be very expensive. You would have to combine the skype API though with some kind of text to speech software. - Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
At 2:34 PM -0800 1/2/08, Jim Lucas wrote: This I think shows what tedd is looking for. so, from this I deduce that this should work. $submit = trim($submit, \xA0\x20); What do you guys/gals think? Nope, not a winner. But it produces some interesting results. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
At 3:36 PM -0500 1/2/08, Daniel Brown wrote: On Jan 2, 2008 3:16 PM, Wolf [EMAIL PROTECTED] wrote: [snip=all] Okay, first of all, Tedd's right my thing didn't work, because I had copied over a script I was working with on the CLI. Secondly, the trim() and str_replace() things work great from the CLI, but not when transmogrified by a combination of the browser, HTTP server, and PHP. Thus, the non-elegant solution that Really Works[tm] is now properly displayed: http://www.pilotpig.net/code-library/tedds-button.php It's ugly, but it does the job. Kinda' like its programmer. Nope, it produces: %C2%C2%C2%C2%C2A%C2%C2%C2 Thanks for trying :-) Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
At 2:58 PM -0600 1/2/08, Richard Lynch wrote: Works for me: [EMAIL PROTECTED] ~/cd $ php -a Interactive mode enabled ?php $a = 'nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp;'; $b = str_replace('nbsp;', '', $a); echo b: $b\n\n; $c = trim($b); echo c: $c\n\n; ? b:A c: A That would work for that, but not for this: Go from this: input type=submit value=nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp via this: $submit = $_POST['submit'] to: A It doesn't appear as simple as what people think it is. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
At 1:08 PM -0800 1/2/08, Casey wrote: OKAY. Let's clarify. Here's the string in HTML: nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp; The browser then passes it to GET/POST. It decodes the entities, and then urlencodes them. Now it looks like this: %a0%20%a0%20%a0%20%a0A%a0%20%a0%20%a0%20%a0 Then PHP receives it, urldecodes the string, then stuffs it inside $_POST, $_GET, $_REQUEST, etc. Now it's like this: A $_POST['submit'] == ' A ' // TRUE. ... *pokes my solution*... $value = trim($value, chr(32) . chr(160)); Good clarification, but not a solution. It didn't work. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
At 4:15 PM -0500 1/2/08, Daniel Brown wrote: On Jan 2, 2008 4:08 PM, Casey [EMAIL PROTECTED] wrote: ... *pokes my solution*... $value = trim($value, chr(32) . chr(160)); You're solution is good, Casey we're just ignoring you because you smell funny. I'm not ignoring him -- it don't work. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
At 3:11 PM -0500 1/2/08, Wolf wrote: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php input type=text value=A size=50 input type=submit Wolf Nice idea, but the submit button has to have the value of A. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
At 3:16 PM -0500 1/2/08, Wolf wrote: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php $string=nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp;; $string=str_replace(nbsp;,,$string); $string=ltrim(rtrim($string))); echo The string is now:$string\n; Outputs: The string is now:A Wolf While that does, that's not the problem. The problem is: input type=submit value=nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp via this: $submit = $_POST['submit'] to produce: A Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
At 3:20 PM -0500 1/2/08, Robert Cummings wrote: ?php $foo = 'nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp;'; $foo = str_replace( 'nbsp;', ' ', $foo ); $foo = trim( ereg_replace( '[ ]+', ' ', $foo ) ); echo '['.$foo.']'.\n; ? Nope, still didn't work for going from this: input type=submit value=nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp to this: A via $submit = $_POST['submit']; Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
At 12:27 PM -0800 1/2/08, Casey wrote: $value = trim($value, chr(32) . chr(160)); Cookie for me? :) -- -Casey No cookie for you. It didn't work. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
On Jan 2, 2008 6:32 PM, tedd [EMAIL PROTECTED] wrote: At 3:36 PM -0500 1/2/08, Daniel Brown wrote: On Jan 2, 2008 3:16 PM, Wolf [EMAIL PROTECTED] wrote: [snip=all] Okay, first of all, Tedd's right my thing didn't work, because I had copied over a script I was working with on the CLI. Secondly, the trim() and str_replace() things work great from the CLI, but not when transmogrified by a combination of the browser, HTTP server, and PHP. Thus, the non-elegant solution that Really Works[tm] is now properly displayed: http://www.pilotpig.net/code-library/tedds-button.php It's ugly, but it does the job. Kinda' like its programmer. Nope, it produces: %C2%C2%C2%C2%C2A%C2%C2%C2 Thanks for trying :-) Why is it that things work perfectly for me until you test them? -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
tedd wrote: At 2:34 PM -0800 1/2/08, Jim Lucas wrote: This I think shows what tedd is looking for. so, from this I deduce that this should work. $submit = trim($submit, \xA0\x20); What do you guys/gals think? Nope, not a winner. But it produces some interesting results. Cheers, tedd I just added the trim() part in the third box down. AFAICT it works like it should. See for yourself. http://www.cmsws.com/examples/html/form_encoding.php Here is the output that I get with FF 2.0.0.11 _POST data is: Name is submit A0 20 A0 20 43 6C 69 63 6B 20 4D 65 21 20 A0 20 Clic k.Me!... 0010 A0. What do you get? -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year. [SOLVED]
At 6:42 PM -0500 1/2/08, Daniel Brown wrote: On Jan 2, 2008 6:32 PM, tedd [EMAIL PROTECTED] wrote: Nope, it produces: %C2%C2%C2%C2%C2A%C2%C2%C2 Thanks for trying :-) Why is it that things work perfectly for me until you test them? It's because I have a tester. You see, it's easy to say Nope, that don't work. But, it's much harder to find a solution. Finding a solution is usually best served when one doesn't under estimate the problem, as many here have already demonstrated. As it turns out, this problem is more complex than any of us has been able to fathom thus far. When a string containing non-breaking spaces is sent via a POST, what do those non-breaking spaces become? It's clear that they are not spaces, nor are they nbsp; To find out, I did put the operation through FireFox and reversed the POST/GET operations to get a look at the string -- it is: %C2%A0%C2%A0%C2%A0Z%C2%A0%C2%A0%C2%A0 where Z is the value passed. Now, C2 (HEX) is a linefeed (194 DEC) And, A0 (HEX) is a non-breaking space (160 DEC;) which is a nbsp; Therefore, if I simply use: $submit = str_replace( chr(194), '', $submit ); $submit = str_replace( chr(160), '', $submit ); This is the solution. Now, why does a POST operation add in C2's? I'll leave that for another post. :-) Thanks everyone for your time. I hope we all learned something, I did. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
At 4:34 PM -0800 1/2/08, Jim Lucas wrote: tedd wrote: At 2:34 PM -0800 1/2/08, Jim Lucas wrote: This I think shows what tedd is looking for. so, from this I deduce that this should work. $submit = trim($submit, \xA0\x20); What do you guys/gals think? Nope, not a winner. But it produces some interesting results. I just added the trim() part in the third box down. AFAICT it works like it should. See for yourself. http://www.cmsws.com/examples/html/form_encoding.php Here is the output that I get with FF 2.0.0.11 _POST data is: Name is submit A0 20 A0 20 43 6C 69 63 6B 20 4D 65 21 20 A0 20 Clic k.Me!... 0010 A0. What do you get? That depends upon what Text Encoding my browser is set to. However, the point is moot. I just tried a variation of your code, namely: $submit = trim($submit, \xA0\xC2); And it worked. So you were on the right track, just using the wrong HEX. See my SOLVED post. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] automatic caller
blackwater dev wrote: I'm working on a prototype now and was wondering if anyone new of a service where I could pass in text and a number and the service would call the number and read the text. I know I can do this with asterisk and it's php api but don't have time to set up all the outgoing code/functionality. Does anyone know of a service that does this so I can show it as a proof of concept. I looked at GrandCentral but it doesn't appear to have this feature. Thanks! a few months/years back, I seem to recall someone creating/playing with an php app that would take text and convert it into an audio file for you. The name I think was phpvox. You might look into that for the service providers that require an audio file. I did a quit google search but couldn't find any references. You might be able to use one of the number of sites that cache the php mailing list and be able to search those for phpvox. -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] automatic caller
blackwater dev wrote: I'm working on a prototype now and was wondering if anyone new of a service where I could pass in text and a number and the service would call the number and read the text. I know I can do this with asterisk and it's php api but don't have time to set up all the outgoing code/functionality. Does anyone know of a service that does this so I can show it as a proof of concept. I looked at GrandCentral but it doesn't appear to have this feature. You mean like this: http://www.php1.net/b/speech/index.php Talk to Daniel Brown [EMAIL PROTECTED] about it because he's a host that provides such service. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year. [SOLVED]
On Jan 2, 2008 7:36 PM, tedd [EMAIL PROTECTED] wrote: At 6:42 PM -0500 1/2/08, Daniel Brown wrote: On Jan 2, 2008 6:32 PM, tedd [EMAIL PROTECTED] wrote: Nope, it produces: %C2%C2%C2%C2%C2A%C2%C2%C2 Thanks for trying :-) Why is it that things work perfectly for me until you test them? It's because I have a tester. You see, it's easy to say Nope, that don't work. But, it's much harder to find a solution. Finding a solution is usually best served when one doesn't under estimate the problem, as many here have already demonstrated. As it turns out, this problem is more complex than any of us has been able to fathom thus far. When a string containing non-breaking spaces is sent via a POST, what do those non-breaking spaces become? It's clear that they are not spaces, nor are they nbsp; To find out, I did put the operation through FireFox and reversed the POST/GET operations to get a look at the string -- it is: %C2%A0%C2%A0%C2%A0Z%C2%A0%C2%A0%C2%A0 where Z is the value passed. Now, C2 (HEX) is a linefeed (194 DEC) And, A0 (HEX) is a non-breaking space (160 DEC;) which is a nbsp; Therefore, if I simply use: $submit = str_replace( chr(194), '', $submit ); $submit = str_replace( chr(160), '', $submit ); This is the solution. Now, why does a POST operation add in C2's? I'll leave that for another post. :-) Thanks everyone for your time. I hope we all learned something, I did. Well, believe it or not, that was the highlight of my day, which began with everything going wrong - not just normal, small things like stubbing your toe, but rather larger - and culminated in my truck burning up while I was driving to a datacenter for a client. Now the research begins why DOES that C2 get thrown in? P.S. - If someone has the answer, don't tell me, because I'd like something to keep Wednesday off my mind for the rest of the week. -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
At 1:38 AM +0100 1/3/08, Jochem (mobile) wrote: tedd schreef: At 3:11 PM -0500 1/2/08, Wolf wrote: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php input type=text value=A size=50 input type=submit Wolf Nice idea, but the submit button has to have the value of A. well I don't think it does. you could try another approach, I didn't mean it that way. I meant for my current logic, I need the value of the submit button to be 'A'. I have much more going on here than just that. I have over 40 different values for the submit button and a switch statement that uses what's submitted. I don't want to, and see no reason to, change it. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL to blame? (was Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?)
M5 wrote: On 20-Dec-07, at 1:17 AM, Per Jessen wrote: René Fournier wrote: I'm really not sure what to try next. ps -aux shows MySQL as hogging the CPU, not PHP or Terminal: When this happens, do a 'SHOW PROCESSLIST' in mysql to see what it's doing. I have, and I can't see anything unusual. There are a few scripts that loop with very slow overhead (with sufficient sleep(), etc.) plus a few outside HTTP requests. Nothing unusual. Incidentally, yesterday, when MySQL went to 80-90% again after a week, I let it stay there while I poked around MySQL (doing the above) and the OS to see if there are some magical limit that I might be breaking. So it the server ran with MySQL at 80-90% CPU for about eight hours. Everything still worked fine, scripts ran, the database was available. That's the thing about this problem--it's not a show-stopper, it's just really strange. And I can't figure its source. Check your mysql logs for just before this time and see if there are any queries there that need attention. Do you have the slow-queries log enabled? Also make sure you have the option to log queries that don't use an index turned on. See if anything there gives you some clues. Are you committing a big transaction (thousands of records or something)? Or do you have a transaction idling and not committing or rolling back? Are you replicating data to another server and this is triggering the problem? Or a backup is running? It doesn't shutdown. Finally--and I really hate doing this, because it sees dangerous to data (is it?)--I issue a kill -9 command to its process. I'd say it's very dangerous to do that to a database but ask the mysql list, they will have better insight into what this does. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php