Re: Invoke PHP script from onLoad handler?

From: Date: Sun, 28 Jan 2001 00:04:41 +0000
Subject: Re: Invoke PHP script from onLoad handler?
Groups: php.general 
Request: Send a blank email to php-general+get-37053@lists.php.net to get a copy of this message
OK, I've gone back through the archives and now understand the situation with client- and server-side. I just wasn't thinking it through. Spawning a window to let PHP query the db and somehow passing returned values back to the parent window is something I could do, I suppose, but it seems that what I and the other zillion people who keep asking the same question need is a way to get to our databases using a client-side technology like Javascript. I recognize the shortcomings of client-side stuff like compatility issues and on/off preferences and in this case am willing to let the user take some reponsibility for his browsing experience. Now I'm completely off-topic, but does anyone have any ideas regarding database access with Javascript, perhaps by having JS run a shell or perl script? How would JS get the values back? Something like function getdb () { var mylist = execute.some.remote.program(./getmysqldata.pl); } With all the traffic on this type of request, I'm surprised the FAQ doesn't take up the subject. Thanks, Chuck ----- Original Message ----- You *can* have a JavaScript handler invoke PHP -- but it requires accessing a URL and waiting for the web-server to respond, so your response time will not be so hot. I'm afraid I don't recall how, but it has been posted here before... -- Visit the Zend Store at http://www.zend.com/store/ Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Chuck Mayo <res035gp@gte.net> Newsgroups: php.general Sent: Friday, January 26, 2001 10:10 AM Subject: [PHP] Invoke PHP script from onLoad handler? > Sorry if this has come up before. > > I want to update a select list from a mySql database whenever the > browser window gets the focus. This is because I anticipate that the > user will frequently use a second window to make additions to the > database that holds the list values while filling in the form, and I > want those additions to be in the select list when the user returns. > > At present I have PHP querying the db before I output the body tag, and > an onLoad() handler passes the returned records to a Javascript which > populates the list box with the query results, but I have only figured > out how to query the db when the page initially loads. I really need to > query the db and invoke the Javascript every time the window gets focus. > > So, I guess my question is twofold: can I invoke a php function with an > onLoad handler, and if so, how can I have onLoad do both things - run > the php function to query the database, then run the Javascript to > populate the list box? Or is there another way? > > TIA, > Chuck Mayo

« previous php.general (#37053) next »