Re: [PHP] PHP, SQL, AJAX, JS and populating a SelectBox?
sry bout that it seems i was logged in :) try this on http://www.ajaxfreaks.com/tutorials/6/0.php; it's called Making a Google Suggest-like application Dave: A most excellent example, but a horrible place to put it. The links are all screwed up and confusing. The pages are not designed well (i.e., way off right for me) and errors on their statistics. Link to your site is broke. But, I was able to salvage your code to produce my own example. http://www.xn--ovg.com/ajax_pop-down This ajax stuff is pretty neat. Would you permit me to post this example elsewhere? I'll provide credit to you. tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP, SQL, AJAX, JS and populating a SelectBox?
as u wish :) tedd wrote: sry bout that it seems i was logged in :) try this on http://www.ajaxfreaks.com/tutorials/6/0.php; it's called Making a Google Suggest-like application Dave: A most excellent example, but a horrible place to put it. The links are all screwed up and confusing. The pages are not designed well (i.e., way off right for me) and errors on their statistics. Link to your site is broke. But, I was able to salvage your code to produce my own example. http://www.xn--ovg.com/ajax_pop-down This ajax stuff is pretty neat. Would you permit me to post this example elsewhere? I'll provide credit to you. tedd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP, SQL, AJAX, JS and populating a SelectBox?
oh, just realized smth :) the tutorial is not mine i have used with success and also posted there but the credit for the tutorial is of: NickName: Gast Member Since: 03/26/2005 Location: Surrey, England Website:http://www.nmcmahon.co.uk he must have the credit for it :) dave wrote: as u wish :) tedd wrote: sry bout that it seems i was logged in :) try this on http://www.ajaxfreaks.com/tutorials/6/0.php; it's called Making a Google Suggest-like application Dave: A most excellent example, but a horrible place to put it. The links are all screwed up and confusing. The pages are not designed well (i.e., way off right for me) and errors on their statistics. Link to your site is broke. But, I was able to salvage your code to produce my own example. http://www.xn--ovg.com/ajax_pop-down This ajax stuff is pretty neat. Would you permit me to post this example elsewhere? I'll provide credit to you. tedd -- Paul Marinas, netadm @ RDS Craiova. GnuPG Key http://pgp.rdscv.ro RCSRDS Craiova Tel.: +40351.400.444 Fax : +40351.400.445 http://www.rcs-rds.ro Privileged/Confidential Information may be contained in this message. If you are not in the addresses indicated in this message (or responsible fordelivery of the message to such person), you may not copy or deliver this message to anyone. In such a case, you should destroy this message and kindly notify the sender by reply e-mail. signature.asc Description: OpenPGP digital signature
RE: [PHP] PHP, SQL, AJAX, JS and populating a SelectBox?
Why invent the wheel? http://developer.ebusiness-apps.com/technologies/webdevelopment/codeandcompo nents/ebawebcombov3/default.htm Sincerely berber Visit the Weber Sites Today, To see where PHP might take you tomorrow. PHP code examples : http://www.weberdev.com PHP MySQL Forums : http://www.weberforums.com Free Uptime Monitor : http://uptime.weberdev.com SEO Data Monitor http://seo.weberdev.com -Original Message- From: Daevid Vincent [mailto:[EMAIL PROTECTED] Sent: Saturday, March 18, 2006 4:43 AM To: php-general@lists.php.net Subject: [PHP] PHP, SQL, AJAX, JS and populating a SelectBox? I need to dynamically update a select box with results from a SQL database using AJAX, but I can't find a single example of how to do this. Basically I have a text input field, and a select box. As someone types in the input field, I want the select box to fill in the results of matches. I can fill in a DIV (as per the ten million examples out there) and that's all fine and dandy, but way too simplistic for what I need. -- 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] PHP, SQL, AJAX, JS and populating a SelectBox?
hi, i used http://www.ajaxfreaks.com/tutorials/6/3.php?topic_id=73hl=104#104 it works just fine, i implemented to one of my web, so far so good. Hope it's what u are looking for Daevid Vincent wrote: I need to dynamically update a select box with results from a SQL database using AJAX, but I can't find a single example of how to do this. Basically I have a text input field, and a select box. As someone types in the input field, I want the select box to fill in the results of matches. I can fill in a DIV (as per the ten million examples out there) and that's all fine and dandy, but way too simplistic for what I need. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP, SQL, AJAX, JS and populating a SelectBox?
I need to dynamically update a select box with results from a SQL database using AJAX, but I can't find a single example of how to do this. Basically I have a text input field, and a select box. As someone types in the input field, I want the select box to fill in the results of matches. I can fill in a DIV (as per the ten million examples out there) and that's all fine and dandy, but way too simplistic for what I need. Select Box? Do you mean a Selection List, that will change as the user types in an input field like this: http://www.itsyourdomain.com/ Just type domain name into the search box -- is that what you're looking for? tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP, SQL, AJAX, JS and populating a SelectBox?
No. All of the examples I find are like the 'google' style suggest-thingy. I want to dynamically (AJAX) populate an actual: select option value='1' foo option value='2' bar option value='3' fee option value='4' fum /select Basically the core problem is passing back an 'array' of data from mysql into JS to make the box. What I've 'hacked' together so far is that I return my values like so from PHP/mySQL to JS AJAX: $tmp = 1|foo|2|bar|3|fee|4|fum; And then in JS, I do this: tokens = tmp.split('|'); Then use a for(i++2) loop and build up the options (key and value) of the select box. But, to me this seems like a hack. Plus I'm a little worried that there is going to be a size limit of characters or data or something? After all, AFAIK AJAX uses $_GET method right? Not $_POST. So I think GET has a limit of like 1024 characters, whereas POST doesn't have that limit. My select box could have potentially thousands of items in it. Say for example, IP addresses. I have supporting select boxes to filter by ranges, or groups, or whatever, but there's nothing restricting a user from NOT using them, and just wanting to see ALL the IP addresses... So, I guess what I'm asking, is, is this the right way to solve this challenge, or is there a better/more accepted way? -Original Message- From: tedd [mailto:[EMAIL PROTECTED] Sent: Saturday, March 18, 2006 1:02 PM To: php-general@lists.php.net; Daevid Vincent Subject: Re: [PHP] PHP, SQL, AJAX, JS and populating a SelectBox? I need to dynamically update a select box with results from a SQL database using AJAX, but I can't find a single example of how to do this. Basically I have a text input field, and a select box. As someone types in the input field, I want the select box to fill in the results of matches. I can fill in a DIV (as per the ten million examples out there) and that's all fine and dandy, but way too simplistic for what I need. Select Box? Do you mean a Selection List, that will change as the user types in an input field like this: http://www.itsyourdomain.com/ Just type domain name into the search box -- is that what you're looking for? tedd -- -- -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP, SQL, AJAX, JS and populating a SelectBox?
No. All of the examples I find are like the 'google' style suggest-thingy. I want to dynamically (AJAX) populate an actual: select option value='1' foo option value='2' bar option value='3' fee option value='4' fum /select Basically the core problem is passing back an 'array' of data from mysql into JS to make the box. What I've 'hacked' together so far is that I return my values like so from PHP/mySQL to JS AJAX: $tmp = 1|foo|2|bar|3|fee|4|fum; And then in JS, I do this: tokens = tmp.split('|'); Then use a for(i++2) loop and build up the options (key and value) of the select box. But, to me this seems like a hack. Plus I'm a little worried that there is going to be a size limit of characters or data or something? After all, AFAIK AJAX uses $_GET method right? Not $_POST. So I think GET has a limit of like 1024 characters, whereas POST doesn't have that limit. My select box could have potentially thousands of items in it. Say for example, IP addresses. I have supporting select boxes to filter by ranges, or groups, or whatever, but there's nothing restricting a user from NOT using them, and just wanting to see ALL the IP addresses... So, I guess what I'm asking, is, is this the right way to solve this challenge, or is there a better/more accepted way? A better acceptable way? I'm clueless as to what is better. Ajax is too new to me to make a determination as to what is the best or acceptable way. I just know that ajax can be used to replace the contents between specific tags in an html document without having to reload the entire page. So, I don't see any reason why you can't replace stuff between select tags with stuff you pull out from mysql. As far as the limit, your assumption is not correct. I just tried a test of over 14,000 characters with no problem at all, see: http://www.xn--ovg.com/ajax1 Click First page So, you shouldn't have any problem populating a select box with thousands of characters -- although you may want to LIMIT that in your mysql and pull it out in shorter segments. tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP, SQL, AJAX, JS and populating a SelectBox?
Ajax can be made to use POST by adding req.open(POST, url, true); // true creates an asynchronous connection req.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); where req is the XHR object Also why not use the same style of formatting for the response as the request uses... eg: foo=My Foobar=My Barwibble=My Wibble The first value is the option value and the second is the option text FWIW I think that using innerHTML is a bad idea as the elements created aren't included in the DOM tree... creating the elements using the DOM is a much better idea... It may be more lengthy by that can be cut down some with clever scripting :) HTH Dan --- http://chrome.me.uk -Original Message- From: Daevid Vincent [mailto:[EMAIL PROTECTED] Sent: 18 March 2006 22:45 To: php-general@lists.php.net Cc: 'tedd' Subject: RE: [PHP] PHP, SQL, AJAX, JS and populating a SelectBox? No. All of the examples I find are like the 'google' style suggest-thingy. I want to dynamically (AJAX) populate an actual: select option value='1' foo option value='2' bar option value='3' fee option value='4' fum /select Basically the core problem is passing back an 'array' of data from mysql into JS to make the box. What I've 'hacked' together so far is that I return my values like so from PHP/mySQL to JS AJAX: $tmp = 1|foo|2|bar|3|fee|4|fum; And then in JS, I do this: tokens = tmp.split('|'); Then use a for(i++2) loop and build up the options (key and value) of the select box. But, to me this seems like a hack. Plus I'm a little worried that there is going to be a size limit of characters or data or something? After all, AFAIK AJAX uses $_GET method right? Not $_POST. So I think GET has a limit of like 1024 characters, whereas POST doesn't have that limit. My select box could have potentially thousands of items in it. Say for example, IP addresses. I have supporting select boxes to filter by ranges, or groups, or whatever, but there's nothing restricting a user from NOT using them, and just wanting to see ALL the IP addresses... So, I guess what I'm asking, is, is this the right way to solve this challenge, or is there a better/more accepted way? -Original Message- From: tedd [mailto:[EMAIL PROTECTED] Sent: Saturday, March 18, 2006 1:02 PM To: php-general@lists.php.net; Daevid Vincent Subject: Re: [PHP] PHP, SQL, AJAX, JS and populating a SelectBox? I need to dynamically update a select box with results from a SQL database using AJAX, but I can't find a single example of how to do this. Basically I have a text input field, and a select box. As someone types in the input field, I want the select box to fill in the results of matches. I can fill in a DIV (as per the ten million examples out there) and that's all fine and dandy, but way too simplistic for what I need. Select Box? Do you mean a Selection List, that will change as the user types in an input field like this: http://www.itsyourdomain.com/ Just type domain name into the search box -- is that what you're looking for? tedd -- -- -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ NOD32 1.1450 (20060318) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP, SQL, AJAX, JS and populating a SelectBox?
I need to dynamically update a select box with results from a SQL database using AJAX, but I can't find a single example of how to do this. Basically I have a text input field, and a select box. As someone types in the input field, I want the select box to fill in the results of matches. I can fill in a DIV (as per the ten million examples out there) and that's all fine and dandy, but way too simplistic for what I need. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php