Re: [PHP] Invoke PHP script from onLoad handler?

2001-01-29 Thread Kristofer Widholm

Here's what you wrote, 01-01-27:

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.

If it's not an enormous amount of data the user will be working with, 
and they're just reading it and not inputting new values (a set 
number of options, etc.), you could just load all the data into 
JavaScript arrays at the initial load. Whenever a part of any form or 
window is changed, the displayed data would be changed as well via 
JavaScript, without the need for any database query.

Kristofer
-- 
__

Kristofer Widholm
Web Pharmacy
[EMAIL PROTECTED]
191 Grand Street, Brooklyn  NY  11211
718.599.4893
__

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Invoke PHP script from onLoad handler?

2001-01-27 Thread Chuck Mayo

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 [EMAIL PROTECTED]
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




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Invoke PHP script from onLoad handler?

2001-01-27 Thread Jonathan Sharp

I wrote a browser based application (yes it is an application!) (but I can't
let you see it cause it's propriatary technology) but the client side was
javascript and I had PHP save the data and read data...

I won't go into detail, but basically I had PHP print JavaScript, and then
have a variable in the main window that the child window would save the new
data to...

for example, have the javascript (which PHP generates) be something like
script
var DATAARY = new Array();
DATAARY[0] = 'Some data';
DATAARY[1] = 'Some data';
DATAARY[2] = 'Some data';
DATAARY[3] = 'Some data';
window.parent.document.MAINDATAARY = DATAARY;
/script
It was something to that extent, it works quite nicely, and it definetly
pushes the limits of the technology used.

-Jonathan Sharp

Director of Technology - Imprev Inc.
Renwick Development Group - Flyerware
http://www.flyerware.com/
Phone: (425)688-9200
Cell: (425)766-1398
EPage: [EMAIL PROTECTED]

-Original Message-
From: Chuck Mayo [mailto:[EMAIL PROTECTED]]
Sent: Saturday, January 27, 2001 4:05 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Invoke PHP script from onLoad handler?


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 [EMAIL PROTECTED]
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




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Invoke PHP script from onLoad handler?

2001-01-27 Thread Markus Fischer

On Sat, Jan 27, 2001 at 06:04:41PM -0600, Chuck Mayo wrote : 
 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);
}

Unless you are running a *signed* JavaScript code you
can't just call an external program (security, anyone ?). If its
just for a intranet, just let your JS code get signed to gain
higher client side access privileges and you are done; else
bummer (at least, this way).

What you could do with normal client side JS is just reload the
opener window.

As far I unterstood, you have a main window with some kind of
listbox depending on database output. Under some circumstances, a
window pops up where the use can alter some data. Just when you
have the feeling, the user has entered/altered enough data to
update the listbox in the window which spawned the popup, force
to reload the page with syntax like

opener.location.href='same_url_again';

and your php script is called again, the db-data is fetched again
and you listbox is altered (hopefully).

m.

-- 
Markus Fischer,  http://josefine.ben.tuwien.ac.at/~mfischer/
EMail: [EMAIL PROTECTED]
PGP Public  Key: http://josefine.ben.tuwien.ac.at/~mfischer/C2272BD0.asc
PGP Fingerprint: D3B0 DD4F E12B F911 3CE1  C2B5 D674 B445 C227 2BD0

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Invoke PHP script from onLoad handler?

2001-01-26 Thread Chuck Mayo

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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]